From Vasilis.Vlachoudis at cern.ch Wed Nov 2 21:51:43 2011 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Wed, 2 Nov 2011 20:51:43 +0000 Subject: [Tkinter-discuss] Muti-column menu Message-ID: <0BC70B5D93E054469872FFD0FE07220E95788327@CERNXCHG11.cern.ch> Hi All, in my application I have a submenu (appearing both on the menu bar and with right-click) that contains many entries ~30. But it has to be in one submenu since they are various types of geometrical bodies to insert. Is there a way to create a multi-column sub-menu in Tkinter? Thanks in advance Vasilis -------------- next part -------------- An HTML attachment was scrubbed... URL: From klappnase at web.de Thu Nov 3 11:36:44 2011 From: klappnase at web.de (Michael Lange) Date: Thu, 3 Nov 2011 11:36:44 +0100 Subject: [Tkinter-discuss] Muti-column menu In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E95788327@CERNXCHG11.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E95788327@CERNXCHG11.cern.ch> Message-ID: <20111103113644.3133475d.klappnase@web.de> Hi Vasilis, Thus spoketh Vasilis Vlachoudis unto us on Wed, 2 Nov 2011 20:51:43 +0000: > Hi All, > > in my application I have a submenu (appearing both on the menu bar and > with right-click) that contains many entries ~30. But it has to be in > one submenu since they are various types of geometrical bodies to > insert. Is there a way to create a multi-column sub-menu in Tkinter? > Yes, all you need to do is menu.entryconfigure(i, columnbreak=1) where i is the index number of the menu item that will appear at the top of a new column. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. No one can guarantee the actions of another. -- Spock, "Day of the Dove", stardate unknown From Vasilis.Vlachoudis at cern.ch Thu Nov 3 11:48:39 2011 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 3 Nov 2011 10:48:39 +0000 Subject: [Tkinter-discuss] Muti-column menu In-Reply-To: <20111103113644.3133475d.klappnase@web.de> References: <0BC70B5D93E054469872FFD0FE07220E95788327@CERNXCHG11.cern.ch>, <20111103113644.3133475d.klappnase@web.de> Message-ID: <0BC70B5D93E054469872FFD0FE07220E95789558@CERNXCHG11.cern.ch> Thank you very much. Exactly what I was looking for. Vasilis ________________________________________ From: tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: 03 November 2011 11:36 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Muti-column menu Hi Vasilis, Thus spoketh Vasilis Vlachoudis unto us on Wed, 2 Nov 2011 20:51:43 +0000: > Hi All, > > in my application I have a submenu (appearing both on the menu bar and > with right-click) that contains many entries ~30. But it has to be in > one submenu since they are various types of geometrical bodies to > insert. Is there a way to create a multi-column sub-menu in Tkinter? > Yes, all you need to do is menu.entryconfigure(i, columnbreak=1) where i is the index number of the menu item that will appear at the top of a new column. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. No one can guarantee the actions of another. -- Spock, "Day of the Dove", stardate unknown _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org http://mail.python.org/mailman/listinfo/tkinter-discuss From Vasilis.Vlachoudis at cern.ch Thu Nov 3 12:11:54 2011 From: Vasilis.Vlachoudis at cern.ch (Vasilis Vlachoudis) Date: Thu, 3 Nov 2011 11:11:54 +0000 Subject: [Tkinter-discuss] Muti-column menu (cont) Message-ID: <0BC70B5D93E054469872FFD0FE07220E95789577@CERNXCHG11.cern.ch> Is it possible to have a separator line extending both columns (something like columnspan=2). If I add two separators, the first one appears ok while the second appears like a dot. from Tkinter import * def showMenu(event=None): menu = Menu(tk,tearoff=0) menu.add_command(label="PLA") menu.add_command(label="XZP") menu.add_separator() menu.add_command(label="RPP") menu.add_command(label="WED") menu.add_separator() menu.add_command(label="SPH") menu.add_separator() menu.add_command(label="RCC") menu.add_command(label="XCC") menu.add_command(label="YCC") menu.add_command(label="ZCC") menu.add_command(label="TRC") menu.add_separator() menu.add_command(label="ARB") menu.add_command(label="TRX") menu.add_command(label="TRZ") menu.add_command(label="XYP") menu.add_command(label="YZP") menu.add_separator() menu.add_command(label="BOX") menu.add_command(label="RAW") menu.add_separator() menu.add_command(label="ELL") menu.add_separator() menu.add_command(label="REC") menu.add_command(label="XEC") menu.add_command(label="YEC") menu.add_command(label="ZEC") menu.add_separator() menu.add_separator() menu.add_command(label="QUA") menu.add_command(label="TRY") menu.entryconfigure(17,columnbreak=1) menu.tk_popup(tk.winfo_pointerx(), tk.winfo_pointery()) tk = Tk() tk.bind("<3>",showMenu) tk.mainloop() Vasilis ________________________________________ From: Vasilis Vlachoudis Sent: 03 November 2011 11:48 To: Michael Lange; tkinter-discuss at python.org Subject: RE: [Tkinter-discuss] Muti-column menu Thank you very much. Exactly what I was looking for. Vasilis ________________________________________ From: tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de] Sent: 03 November 2011 11:36 To: tkinter-discuss at python.org Subject: Re: [Tkinter-discuss] Muti-column menu Hi Vasilis, Thus spoketh Vasilis Vlachoudis unto us on Wed, 2 Nov 2011 20:51:43 +0000: > Hi All, > > in my application I have a submenu (appearing both on the menu bar and > with right-click) that contains many entries ~30. But it has to be in > one submenu since they are various types of geometrical bodies to > insert. Is there a way to create a multi-column sub-menu in Tkinter? > Yes, all you need to do is menu.entryconfigure(i, columnbreak=1) where i is the index number of the menu item that will appear at the top of a new column. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. No one can guarantee the actions of another. -- Spock, "Day of the Dove", stardate unknown _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss at python.org http://mail.python.org/mailman/listinfo/tkinter-discuss From klappnase at web.de Thu Nov 3 12:30:18 2011 From: klappnase at web.de (Michael Lange) Date: Thu, 3 Nov 2011 12:30:18 +0100 Subject: [Tkinter-discuss] Muti-column menu (cont) In-Reply-To: <0BC70B5D93E054469872FFD0FE07220E95789577@CERNXCHG11.cern.ch> References: <0BC70B5D93E054469872FFD0FE07220E95789577@CERNXCHG11.cern.ch> Message-ID: <20111103123018.31350bb2.klappnase@web.de> Hi, Thus spoketh Vasilis Vlachoudis unto us on Thu, 3 Nov 2011 11:11:54 +0000: > Is it possible to have a separator line extending both columns > (something like columnspan=2). If I add two separators, the first one > appears ok while the second appears like a dot. > The same here, seems like you cannot create a separator line in the second column at all. I have no idea why, I thought this was supposed to work. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Lots of people drink from the wrong bottle sometimes. -- Edith Keeler, "The City on the Edge of Forever", stardate unknown From jiayuaw at yahoo.com.sg Mon Nov 7 02:26:04 2011 From: jiayuaw at yahoo.com.sg (Kristen Aw) Date: Mon, 7 Nov 2011 09:26:04 +0800 (SGT) Subject: [Tkinter-discuss] about Tkinter delete Message-ID: <1320629164.710.YahooMailNeo@web77902.mail.sg1.yahoo.com> Hi all I don't understand why I get this error. I'm trying to delete the existing points, then redraw them after this bit of code to 'animate' my simulation. def update(self, point1, point2): ? ? ? ? # Deletes existing points ? ? ? ? if self.point1: ? ? ? ? ? ? self.w.delete(point1) ? ? ? ? ? ? self.master.update_idletasks() ? ? ? ? if self.point2: ? ? ? ? ? ? self.w.delete(point2) ? ? ? ? ? ? self.master.update_idletasks() #draw new point # . . . The error message that I get is: . . .?in update ? ? self.w.delete(point1) ? File "C:\PYTHON26\LIB\LIB-TK\Tkinter.py", line 2181, in delete ? ? self.tk.call((self._w, 'delete') + args) TclError: invalid command name ".44593760" -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.odonnell at uam.es Mon Nov 7 17:07:58 2011 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Mon, 7 Nov 2011 17:07:58 +0100 Subject: [Tkinter-discuss] about Tkinter delete In-Reply-To: <1320629164.710.YahooMailNeo@web77902.mail.sg1.yahoo.com> References: <1320629164.710.YahooMailNeo@web77902.mail.sg1.yahoo.com> Message-ID: Dear Kristen, Sorry, don't know the context of your code, but I note that you are checking if self.point1 is defined, and if so, try to delete point1 (which is a different variable). Also, self.point1/point1 may be defined, but may not correspond to an existing tk widget. The error message suggests that you are trying to delete a widget (.44593760) which has already been deleted. Mick On Mon, Nov 7, 2011 at 2:26 AM, Kristen Aw wrote: > Hi all > I don't understand why I get this error. I'm trying to delete the existing > points, then redraw them after this bit of code to 'animate' my simulation. > def update(self, point1, point2): > ? ? ? ? # Deletes existing points > ? ? ? ? if self.point1: > ? ? ? ? ? ? self.w.delete(point1) > ? ? ? ? ? ? self.master.update_idletasks() > ? ? ? ? if self.point2: > ? ? ? ? ? ? self.w.delete(point2) > ? ? ? ? ? ? self.master.update_idletasks() > #draw new point > # . . . > The error message that I get is: > . . .?in update > ? ? self.w.delete(point1) > ? File "C:\PYTHON26\LIB\LIB-TK\Tkinter.py", line 2181, in delete > ? ? self.tk.call((self._w, 'delete') + args) > TclError: invalid command name ".44593760" > > > > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss at python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > > From michael.odonnell at uam.es Mon Nov 7 17:15:06 2011 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Mon, 7 Nov 2011 17:15:06 +0100 Subject: [Tkinter-discuss] CX_freeze and Tkinter on Macosx with Python 2.7 Message-ID: Hi all, Has anyone had any luck getting CX_freeze to work with a Tkinter-based application on Macosx for Python 2.7? I tried, and firstly it tried looking for the tcl and tk libraries in the wrong places. And once I patched that problem, it tried to write these folders to the build folder, but using the same folder names as existing files (which i think are the dynamic load libraries for tcl and tk). If it worked for you without problem, that's enough for me. Let me know. Mick From kw at codebykevin.com Mon Nov 7 17:17:24 2011 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 07 Nov 2011 11:17:24 -0500 Subject: [Tkinter-discuss] CX_freeze and Tkinter on Macosx with Python 2.7 In-Reply-To: References: Message-ID: <4EB80494.1070902@codebykevin.com> On 11/7/11 11:15 AM, Michael O'Donnell wrote: > Hi all, > > Has anyone had any luck getting CX_freeze to work with > a Tkinter-based application on Macosx for Python 2.7? Any reason you are using CX_freeze and not py2app, which is the most-developed and best-tested solution for freezing an app on OS X? -- Kevin Walzer Code by Kevin http://www.codebykevin.com From michael.odonnell at uam.es Mon Nov 7 18:29:31 2011 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Mon, 7 Nov 2011 18:29:31 +0100 Subject: [Tkinter-discuss] CX_freeze and Tkinter on Macosx with Python 2.7 In-Reply-To: <4EB80494.1070902@codebykevin.com> References: <4EB80494.1070902@codebykevin.com> Message-ID: > Any reason you are using CX_freeze and not py2app, which is the > most-developed and best-tested solution for freezing an app on OS X? I have used py2app happily for years. With the change to ActivePython 2.7.2, my py2app script stopped running. SystemExit: error: argv-emulation is not supported for 64-bit executables Seems that there was (is?) a problem with argv emulation on the 64 bit version. I found two solutions. 1) Use ActiveState's pure 32 bit installer for Python 2.7.2. BUT, this uses Tcl 8.4, and I need 8.5 for unicode display. 2) Get rid of any use of argv use in my target application (which is a bit of a problem for my app. 3) Run my py2app script with python2.7-32 in a shell window, The script actually worked, but the constructed application failed, some problem in _get_argvemulator().mainloop(), which makes me think it is the same problem in a different guise. Is my application 64 bits even though compiled in 32 bit python? How would one tell py2app to use the 32 bit python as a base? So, while my application runs fine on my own machine I can't seem to use py2app to make a functional standalone. I was hoping cx_freeze would avoid some of these problems. But just got me deeper into debugging woes. Mick From kw at codebykevin.com Mon Nov 7 21:15:38 2011 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 07 Nov 2011 15:15:38 -0500 Subject: [Tkinter-discuss] CX_freeze and Tkinter on Macosx with Python 2.7 In-Reply-To: References: <4EB80494.1070902@codebykevin.com> Message-ID: <4EB83C6A.1070108@codebykevin.com> On 11/7/11 12:29 PM, Michael O'Donnell wrote: > I have used py2app happily for years. With the change to ActivePython 2.7.2, > my py2app script stopped running. > > SystemExit: error: argv-emulation is not supported for 64-bit executables I believe the latest version of py2app has implemented support for argv-emulation--check the list archives at the MacPython mailing list for details. Installing it might require downloading via the source tree rather than an official release, but hopefully that won't present a problem. As I understand it, none of the other "freezing" solutions for Python work well on the Mac--they are either half-baked, lack a signifcant community/user base, or both. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From michael.odonnell at uam.es Mon Nov 7 22:30:18 2011 From: michael.odonnell at uam.es (Michael O'Donnell) Date: Mon, 7 Nov 2011 22:30:18 +0100 Subject: [Tkinter-discuss] CX_freeze and Tkinter on Macosx with Python 2.7 In-Reply-To: <4EB83C6A.1070108@codebykevin.com> References: <4EB80494.1070902@codebykevin.com> <4EB83C6A.1070108@codebykevin.com> Message-ID: Thanks Kevin, Will look into it, Mick On Mon, Nov 7, 2011 at 9:15 PM, Kevin Walzer wrote: > On 11/7/11 12:29 PM, Michael O'Donnell wrote: >> >> I have used py2app happily for years. With the change to ActivePython >> 2.7.2, >> my py2app script stopped running. >> >> SystemExit: error: argv-emulation is not supported for 64-bit executables > > I believe the latest version of py2app has implemented support for > argv-emulation--check the list archives at the MacPython mailing list for > details. Installing it might require downloading via the source tree rather > than an official release, but hopefully that won't present a problem. > > As I understand it, none of the other "freezing" solutions for Python work > well on the Mac--they are either half-baked, lack a signifcant > community/user base, or both. > > -- > Kevin Walzer > Code by Kevin > http://www.codebykevin.com > From msa01 at bitflipper.ca Sat Nov 26 17:54:09 2011 From: msa01 at bitflipper.ca (Cam Farnell) Date: Sat, 26 Nov 2011 12:54:09 -0400 Subject: [Tkinter-discuss] Button-press on Menubuttons In-Reply-To: <20111103123018.31350bb2.klappnase@web.de> References: <0BC70B5D93E054469872FFD0FE07220E95789577@CERNXCHG11.cern.ch> <20111103123018.31350bb2.klappnase@web.de> Message-ID: <4ED119B1.2020002@bitflipper.ca> I have a bunch of Menubuttons in my application, lets call them A, B and C. Each Menubutton is bound to so, before the menu choices are displayed, I can enable/disable some of those choices depending on the situation at the time, and each binding leads to its own Menubutton-specific handler. If the user clicks on Menubutton-A then the corresponding handler runs as expected. If, without making a choice from menu A, the user then clicks on Menubutton-B then - and this is the nub of the problem - the handler bound to Menubutton-B does NOT run. If the user now clicks on Menubutton-C, then the handler for B, yes B, runs. Is this a bug, a feature or me being stupid? I'm running Python 2.6.5 on Ubuntu 10.04. The simplest demonstration example I could manage follows. Clicking on Menubutton A shows, in the label to the right of the Menubuttons, that the handler ran. If you then click immediately (without selecting any of the dummy menu choices or otherwise making the open menu go away) on Menubutton B then the handler does not run. If you then click on Menubutton A (or for that, click again in Menubutton B) then the handler for B runs. I've already developed a workaround for my particular application, but this strikes me as anomalous behavior. Cheers Cam Farnell import Tkinter as tk class Application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.pack() self.MenuButtonA = tk.Menubutton(self,text='Menu Button A') self.MenuButtonA.pack(side='left') T = tk.Menu(self.MenuButtonA) T.add_command(label='Dummy 1') T.add_command(label='Dummy 2') self.MenuButtonA['menu'] = T self.MenuButtonA.bind('',self.HandlerA) self.MenuButtonB = tk.Menubutton(self,text='Menu Button B') self.MenuButtonB.pack(side='left') T = tk.Menu(self.MenuButtonB) T.add_command(label='Dummy 1') T.add_command(label='Dummy 2') self.MenuButtonB['menu'] = T self.MenuButtonB.bind('',self.HandlerB) self.InfoLabel = tk.Label(self,text='---------') self.InfoLabel.pack(side='left') def HandlerA(self,Event): self.InfoLabel['text'] = 'Handler A' def HandlerB(self,Event): self.InfoLabel['text'] = 'Handler B' app = Application() app.master.title("Sample application") app.mainloop() From klappnase at web.de Sat Nov 26 19:37:58 2011 From: klappnase at web.de (Michael Lange) Date: Sat, 26 Nov 2011 19:37:58 +0100 Subject: [Tkinter-discuss] Button-press on Menubuttons In-Reply-To: <4ED119B1.2020002@bitflipper.ca> References: <0BC70B5D93E054469872FFD0FE07220E95789577@CERNXCHG11.cern.ch> <20111103123018.31350bb2.klappnase@web.de> <4ED119B1.2020002@bitflipper.ca> Message-ID: <20111126193758.20c2feb9.klappnase@web.de> Hi, Thus spoketh Cam Farnell unto us on Sat, 26 Nov 2011 12:54:09 -0400: (..) > > If the user clicks on Menubutton-A then the corresponding handler runs > as expected. If, without making a choice from menu A, the user then > clicks on Menubutton-B then - and this is the nub of the problem - the > handler bound to Menubutton-B does NOT run. If the user now clicks on > Menubutton-C, then the handler for B, yes B, runs. Not sure, I guess this has something to do with the Menu's event-grabbing. Maybe a better solution than binding to the Menubuttons is to use the menu's postcommand option as in: import Tkinter as tk class Application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.pack() self.MenuButtonA = tk.Menubutton(self,text='Menu Button A') self.MenuButtonA.pack(side='left') self.TA = TA = tk.Menu(self.MenuButtonA) TA.add_command(label='Dummy 1') TA.add_command(label='Dummy 2') self.MenuButtonA['menu'] = TA TA.config(postcommand=self.HandlerA) self.MenuButtonB = tk.Menubutton(self,text='Menu Button B') self.MenuButtonB.pack(side='left') self.TB = TB = tk.Menu(self.MenuButtonB) TB.add_command(label='Dummy 1') TB.add_command(label='Dummy 2') self.MenuButtonB['menu'] = TB TB.config(postcommand=self.HandlerB) self.InfoLabel = tk.Label(self,text='---------') self.InfoLabel.pack(side='left') def HandlerA(self,Event=None): self.InfoLabel['text'] = 'Handler A' print 'Handler A' self.TA.entryconfigure(1, label='FOO') def HandlerB(self,Event=None): self.InfoLabel['text'] = 'Handler B' print 'Handler B' self.TB.entryconfigure(1, state='disabled') app = Application() app.master.title("Sample application") app.mainloop() Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. We fight only when there is no other choice. We prefer the ways of peaceful contact. -- Kirk, "Spectre of the Gun", stardate 4385.3 From msa01 at bitflipper.ca Sat Nov 26 20:54:51 2011 From: msa01 at bitflipper.ca (Cam Farnell) Date: Sat, 26 Nov 2011 15:54:51 -0400 Subject: [Tkinter-discuss] Button-press on Menubuttons In-Reply-To: <20111126193758.20c2feb9.klappnase@web.de> References: <0BC70B5D93E054469872FFD0FE07220E95789577@CERNXCHG11.cern.ch> <20111103123018.31350bb2.klappnase@web.de> <4ED119B1.2020002@bitflipper.ca> <20111126193758.20c2feb9.klappnase@web.de> Message-ID: <4ED1440B.3010706@bitflipper.ca> Thanks, using the postcommand option does the job but it still strikes me as odd that a menubutton which has been been activated by clicking on it doesn't generate a event. Cam On 11-11-26 02:37 PM, Michael Lange wrote: > Hi, > > Thus spoketh Cam Farnell > unto us on Sat, 26 Nov 2011 12:54:09 -0400: > > (..) >> >> If the user clicks on Menubutton-A then the corresponding handler runs >> as expected. If, without making a choice from menu A, the user then >> clicks on Menubutton-B then - and this is the nub of the problem - the >> handler bound to Menubutton-B does NOT run. If the user now clicks on >> Menubutton-C, then the handler for B, yes B, runs. > > Not sure, I guess this has something to do with the Menu's event-grabbing. > Maybe a better solution than binding to the Menubuttons is to use the > menu's postcommand option as in: > From klappnase at web.de Sun Nov 27 12:12:48 2011 From: klappnase at web.de (Michael Lange) Date: Sun, 27 Nov 2011 12:12:48 +0100 Subject: [Tkinter-discuss] Button-press on Menubuttons In-Reply-To: <4ED1440B.3010706@bitflipper.ca> References: <0BC70B5D93E054469872FFD0FE07220E95789577@CERNXCHG11.cern.ch> <20111103123018.31350bb2.klappnase@web.de> <4ED119B1.2020002@bitflipper.ca> <20111126193758.20c2feb9.klappnase@web.de> <4ED1440B.3010706@bitflipper.ca> Message-ID: <20111127121248.9bb87adc.klappnase@web.de> Thus spoketh Cam Farnell unto us on Sat, 26 Nov 2011 15:54:51 -0400: > Thanks, using the postcommand option does the job but it still strikes > me as odd that a menubutton which has been been activated by clicking > on it doesn't generate a event. > Now, I guess what actually happens is this: when Menu A is being mapped it does a grab_set_global() behind the scenes, which is useful, because it needs to be aware if the user clicks for example on the desktop and as a consequence of this the menu must be unmapped. There is no other way for tk to know this than the global grab. Now when you click Menubutton B with Menu A still being mapped, the ButtonPress event is actually being grabbed by Menu A. Right now I can see the same behavior if I run your test app on top of my mail client's window: when I click into the mail client while Menu A is mapped, the menu disappears but the test app stays on top of the mail client, which is perfectly normal in this context, it would be confusing if the test app would be hidden under the other window on the first mouse click when I just want to "click away" the menu. It seems like it is exactly the same which now confuses you; probably the tk developers decided that it's better to confuse programmers than users ;) Maybe what happens becomes clearer if you add a few additional callbacks with print statements to your example : ####################### import Tkinter as tk class Application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.pack() self.MenuButtonA = tk.Menubutton(self,text='Menu Button A') self.MenuButtonA.pack(side='left') self.TA = TA = tk.Menu(self.MenuButtonA) TA.add_command(label='Dummy 1') TA.add_command(label='Dummy 2') self.MenuButtonA['menu'] = TA #TA.config(postcommand=self.HandlerA) self.MenuButtonA.bind('',self.HandlerA, '+') TA.bind('', self.on_map_A, '+') TA.bind('', self.on_unmap_A, '+') self.MenuButtonA.bind('',self.on_b1_A, '+') self.MenuButtonA.bind('',self.on_b1release_A, '+') self.MenuButtonB = tk.Menubutton(self,text='Menu Button B') self.MenuButtonB.pack(side='left') self.TB = TB = tk.Menu(self.MenuButtonB) TB.add_command(label='Dummy 1') TB.add_command(label='Dummy 2') self.MenuButtonB['menu'] = TB #TB.config(postcommand=self.HandlerB) self.MenuButtonB.bind('',self.HandlerB, '+') TB.bind('', self.on_map_B, '+') TB.bind('', self.on_unmap_B, '+') self.MenuButtonB.bind('',self.on_b1_B, '+') self.MenuButtonB.bind('',self.on_b1release_B, '+') self.InfoLabel = tk.Label(self,text='---------') self.InfoLabel.pack(side='left') def HandlerA(self,Event=None): self.InfoLabel['text'] = 'Handler A' print 'Handler A' self.TA.entryconfigure(1, label='FOO') def HandlerB(self,Event=None): self.InfoLabel['text'] = 'Handler B' print 'Handler B' self.TB.entryconfigure(1, state='disabled') def on_b1_A(self, event): print 'button 1 pressed over Menubutton A' def on_b1release_A(self, event): print 'button 1 released over Menubutton A' def on_b1_B(self, event): print 'button 1 pressed over Menubutton B' def on_b1release_B(self, event): print 'button 1 released over Menubutton B' def on_map_A(self, event): print 'Menu A mapped' def on_map_B(self, event): print 'Menu B mapped' def on_unmap_A(self, event): print 'Menu A unmapped' def on_unmap_B(self, event): print 'Menu B unmapped' app = Application() app.master.title("Sample application") app.mainloop() ####################### When you run this, you see that while Menu A is mapped the button press event never reaches Menubutton B. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. It [being a Vulcan] means to adopt a philosophy, a way of life which is logical and beneficial. We cannot disregard that philosophy merely for personal gain, no matter how important that gain might be. -- Spock, "Journey to Babel", stardate 3842.4