fixed my dum dum
parent
14c19f3d69
commit
a3d6129bad
14
main.py
14
main.py
|
@ -223,34 +223,22 @@ def build_menu(structure_dict, menu):
|
|||
for entry in structure_dict:
|
||||
if structure_dict[entry]==None:
|
||||
if entry==None:
|
||||
info("Adding separator for " + str(entry))
|
||||
menu.add_separator()
|
||||
else:
|
||||
info("Adding disabled entry for " + str(entry))
|
||||
menu.add_command(label=entry)
|
||||
menu.entryconfig(entry, state="disabled")
|
||||
if isinstance(structure_dict[entry], dict):
|
||||
info("Adding submenu for " + str(entry))
|
||||
submenu = tk.Menu(menu, tearoff=False)
|
||||
build_menu(structure_dict[entry], submenu)
|
||||
menu.add_cascade(label=entry, menu=submenu)
|
||||
if callable(structure_dict[entry]):
|
||||
info("Adding entry for "+str(entry))
|
||||
menu.add_command(label=entry, command=structure_dict[entry])
|
||||
|
||||
def rebuild_menu():
|
||||
menubar = tk.Menu(main_window)
|
||||
menubar = build_menu(menu_structure, menubar)
|
||||
build_menu(menu_structure, menubar)
|
||||
main_window.config(menu=menubar)
|
||||
|
||||
rebuild_menu()
|
||||
#menubar = tk.Menu(main_window)
|
||||
#menus = {}
|
||||
#menus["Project"] = tk.Menu(menubar, tearoff=False)
|
||||
#menus["Project"].add_command(label="Open...", command=not_implemented)
|
||||
#menus["Project>Close"] = tk.Menu(menus["Project"], tearoff=False)
|
||||
#menus["Project"].add_cascade(label="Close", menu=menus["Project>Close"])
|
||||
#menubar.add_cascade(label="Project", menu=menus["Project"])
|
||||
#main_window.config(menu=menubar)
|
||||
|
||||
main_window.mainloop()
|
||||
|
|
Reference in New Issue