I'm working on a Gui and I'd like to know if it is possible to make the menu property of a window a separate class on my script for a clearer and more enhancement prone code.
my code currently is :
class Application(Frame):
""" main window application """
def __init__(self, boss = None):
(...)
self.menu = Menu(self)
self.master.config(menu = self.menu)
self.select = Menu(self.menu)
self.menu.add_cascade(label = 'Select', menu = self.select)
self.select.add_command(label = 'Select all', command = self.select_all)
...
And I would prefer something like :
class MenuBar:
# all the content of the menu here
class Application(Frame):
(...)
self.menu = MenuBar(self) ?
rgds,
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…