更改select
Build and Publish / Run (push) Successful in 47s Details

This commit is contained in:
cxykevin 2024-05-01 13:45:21 +08:00
parent a4de1f152c
commit c450344fc2
1 changed files with 7 additions and 2 deletions

View File

@ -61,7 +61,7 @@ class Select(button.Button):
super().__init__(master=master, root_anim=root_anim, w=w,
h=h, text=text, color_list=color_list, _set_defaultcolor=True)
self.__menuobj = submenu.MenuObjs()
self.__last = 0
self.__last = -1
for i in self.items:
self.__menuobj.addmenu(i, self._callback_menu)
@ -71,9 +71,11 @@ class Select(button.Button):
def change_menu(self, items):
self.items = items
self.__menuobj = submenu.MenuObjs()
self.__last = 0
self.__last = -1
for i in self.items:
self.__menuobj.addmenu(i, self._callback_menu)
self.canvas.itemconfigure(self.__text_obj, text=self.text)
self.canvas.moveto(self.__text_obj, 16, self.h//2-10)
def _draw(self):
super()._draw(True)
@ -170,3 +172,6 @@ class Select(button.Button):
)
self._update_color()
self.canvas.bind("<ButtonRelease-1>", pressrelease_v)
def get(self):
return self.__last