"Chuckk Hubbard" <badmuthahubbar d@gmail.comwrit es:
Try creating the "main" popup menu before the sub-menus, and when
instantiating the sub-menus, pass the main menu as the "master"
instead of "self.myparent" :
....snip code -----------------------------------------
self.canvas.bin d("<Button-3>",self.popup )
self.menupopup = tk.Menu(self.my parent, tearoff=0)
self.menupopup1 = tk.Menu(self.me nupopup, tearoff=0)
self.menupopup1 .add_command(la bel="Test1", command=self.se lected)
self.menupopup1 .add_command(la bel="Test2", command=self.se lected)
self.menupopup1 .add_command(la bel="Test3", command=self.se lected)
self.menupopup2 = tk.Menu(self.me nupopup, tearoff=0)
self.menupopup2 .add_command(la bel="Test1", command=self.se lected)
self.menupopup2 .add_command(la bel="Test2", command=self.se lected)
self.menupopup2 .add_command(la bel="Test3", command=self.se lected)
# self.menupopup = tk.Menu(self.my parent, tearoff=0)
self.menupopup. add_cascade(lab el="Test1", menu=self.menup opup1)
self.menupopup. add_cascade(lab el="Test2", menu=self.menup opup2)
....end code changes ----------------------------------
Hope that helps.
Carl.
Right-click popup menu. None of the options that come from the
cascades can be selected with the mouse. If you select a submenu with
the mouse and then use the arrow keys and enter key to select an
option, it works, but the menu remains on the canvas. If you click
the option with the mouse, the menu disappears but the function
doesn't get called.
Can someone tell me why?
>
-Chuckk
>
--
http://www.badmuthahubbard.com
cascades can be selected with the mouse. If you select a submenu with
the mouse and then use the arrow keys and enter key to select an
option, it works, but the menu remains on the canvas. If you click
the option with the mouse, the menu disappears but the function
doesn't get called.
Can someone tell me why?
>
-Chuckk
>
--
http://www.badmuthahubbard.com
instantiating the sub-menus, pass the main menu as the "master"
instead of "self.myparent" :
....snip code -----------------------------------------
self.canvas.bin d("<Button-3>",self.popup )
self.menupopup = tk.Menu(self.my parent, tearoff=0)
self.menupopup1 = tk.Menu(self.me nupopup, tearoff=0)
self.menupopup1 .add_command(la bel="Test1", command=self.se lected)
self.menupopup1 .add_command(la bel="Test2", command=self.se lected)
self.menupopup1 .add_command(la bel="Test3", command=self.se lected)
self.menupopup2 = tk.Menu(self.me nupopup, tearoff=0)
self.menupopup2 .add_command(la bel="Test1", command=self.se lected)
self.menupopup2 .add_command(la bel="Test2", command=self.se lected)
self.menupopup2 .add_command(la bel="Test3", command=self.se lected)
# self.menupopup = tk.Menu(self.my parent, tearoff=0)
self.menupopup. add_cascade(lab el="Test1", menu=self.menup opup1)
self.menupopup. add_cascade(lab el="Test2", menu=self.menup opup2)
....end code changes ----------------------------------
Hope that helps.
Carl.
Comment