[Tkinter-discuss] Button-press on Menubuttons

Cam Farnell msa01 at bitflipper.ca
Sat Nov 26 20:54:51 CET 2011

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 <ButtonPress> event.


On 11-11-26 02:37 PM, Michael Lange wrote:
> Hi,
> Thus spoketh Cam Farnell<msa01 at bitflipper.ca>
> 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:

More information about the Tkinter-discuss mailing list