补充button的forget和select的change
Build and Publish / Run (push) Successful in 59s Details

This commit is contained in:
cxykevin 2024-05-01 11:05:34 +08:00
parent fc55478b12
commit a4de1f152c
2 changed files with 16 additions and 0 deletions

View File

@ -166,6 +166,15 @@ class Button:
def place(self, *args, **kwargs): def place(self, *args, **kwargs):
self.canvas.place(*args, **kwargs) self.canvas.place(*args, **kwargs)
def pack_forget(self, *args, **kwargs):
self.canvas.pack_forget(*args, **kwargs)
def grid_forget(self, *args, **kwargs):
self.canvas.grid_forget(*args, **kwargs)
def place_forget(self, *args, **kwargs):
self.canvas.place_forget(*args, **kwargs)
def _draw(self, _use_self_text=None): def _draw(self, _use_self_text=None):
self._draw_corner(0, 0, 0, 0) self._draw_corner(0, 0, 0, 0)
self._draw_corner(1, 0, self.w-4, 0) self._draw_corner(1, 0, self.w-4, 0)

View File

@ -68,6 +68,13 @@ class Select(button.Button):
for event, eventfunc in master.p_event_list: for event, eventfunc in master.p_event_list:
self.canvas.bind(event, eventfunc) self.canvas.bind(event, eventfunc)
def change_menu(self, items):
self.items = items
self.__menuobj = submenu.MenuObjs()
self.__last = 0
for i in self.items:
self.__menuobj.addmenu(i, self._callback_menu)
def _draw(self): def _draw(self):
super()._draw(True) super()._draw(True)