[Tkinter-discuss] Working with tear-off menus (change the "-----" label, customize location/appearance of tear-off window)

2010-11-21 Thread python
I've been experimenting with Tkinter tear-off menus and have the following questions (relative to Windows): 1. Is there a way to change the default appearance of the "--" menu label that is used to indicate a tear-off menu -OR- is there a way to programmatically convert a menu widget to a torn

Re: [Tkinter-discuss] Bind to event related to currently selected menu item

2010-11-21 Thread python
Hi Michael, > The problem is apparently that the widget name of the menu's "button" is > assigned by Tk and there does not seem to be a way to access this subwidget > from within Tkinter. Besides this I don't understand why this does not happen > with the context menu from my previous example b

Re: [Tkinter-discuss] Looking for example of how to use <> to determine currently selected menu item

2010-11-21 Thread python
Michael(s): > def callback(event): >    print event.widget.index('active') > > I see, this happens only with cascade menus, in my example I only had a > popup menu, for which it worked as expected. Right now I am trying to > figure out what's wrong with Tkinter (it's definitely a bug within > Tkin

Re: [Tkinter-discuss] Looking for example of how to use <> to determine currently selected menu item

2010-11-21 Thread python
Hi Michael(s): > At least in Python 2.5.4 linked to Tk 8.4 (Windows version), > the following fails because event.widget holds a string (the tcl/tk > widget name), not a Tkinter class. > > def callback(event): >    print event.widget.index('active') > > Maybe fixed in later editions This fails i

Re: [Tkinter-discuss] Bind to event related to currently selected menu item

2010-11-21 Thread python
Michael, Thank you! That's EXACTLY the solution I was looking for :) Regards, Malcolm Change your statusbarUpdate for the following, which will print out the index of the currently selected menu item: def statusbarUpdate( event=None ): print tk.call(event.widget, "index", "active") Note th

Re: [Tkinter-discuss] Bind to event related to currently selected menu item

2010-11-21 Thread Michael Lange
Hi, Thus spoketh "Michael O'Donnell" unto us on Sun, 21 Nov 2010 10:26:24 +0100: > Hi Malcom, > > Change your statusbarUpdate for the following, which will print out > the index of the currently selected menu item: > > def statusbarUpdate( event=None ): >print tk.call(event.widget, "index

Re: [Tkinter-discuss] Looking for example of how to use <> to determine currently selected menu item

2010-11-21 Thread Michael Lange
Hi Mick, Thus spoketh "Michael O'Donnell" unto us on Sun, 21 Nov 2010 13:05:49 +0100: > Hi Michael, > > At least in Python 2.5.4 linked to Tk 8.4 (Windows version), > the following fails because event.widget holds a string (the tcl/tk > widget name), not a Tkinter class. > > > def callback(e

Re: [Tkinter-discuss] Looking for example of how to use <> to determine currently selected menu item

2010-11-21 Thread Michael O'Donnell
Hi Michael, At least in Python 2.5.4 linked to Tk 8.4 (Windows version), the following fails because event.widget holds a string (the tcl/tk widget name), not a Tkinter class. > def callback(event): >    print event.widget.index('active') Maybe fixed in later editions, but if one wants a soluti

Re: [Tkinter-discuss] Looking for example of how to use <> to determine currently selected menu item

2010-11-21 Thread Michael Lange
Hi Malcolm, Thus spoketh pyt...@bdurham.com unto us on Sat, 20 Nov 2010 18:09:58 -0500: > Hi Michael, > > Thank you for your idea to use the event. That works when I use > the mouse, but it doesn't work when a user uses the cursor keys to move > between menu items. sure, you're right, I didn'

Re: [Tkinter-discuss] Bind to event related to currently selected menu item

2010-11-21 Thread Michael O'Donnell
Hi Malcom, Change your statusbarUpdate for the following, which will print out the index of the currently selected menu item: def statusbarUpdate( event=None ): print tk.call(event.widget, "index", "active") Note that this uses tcl/tk code, where Tkinter code should be used, but it seems the