[Tkinter-discuss] Tkinter Menu

Metz, Bobby W, WWCS bwmetz at att.com
Tue Jul 11 23:37:39 CEST 2006


yeh, you won't find it in a lot of tkinter references...at least my initial queries for such a feature turned up squat months ago.  The "end" word should work as well, but I've always used "last".

Bobby

-----Original Message-----
From: Fuzzyman [mailto:fuzzyman at voidspace.org.uk]
Sent: Tuesday, July 11, 2006 2:20 AM
To: Metz, Bobby W, WWCS
Cc: tkinter-discuss at python.org
Subject: Re: [Tkinter-discuss] Tkinter Menu


Metz, Bobby W, WWCS wrote:

>Deleting is easiest using the index feature.  In your case:
>
>if menu.index("last") is not None:
>	menu.delete(0, menu.index("last") - 2)
>  
>
Cool, I didn't know you could do that.

Thanks

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml


>Bobby
>
>-----Original Message-----
>From: tkinter-discuss-bounces at python.org
>[mailto:tkinter-discuss-bounces at python.org]On Behalf Of Michael Foord
>Sent: Monday, July 10, 2006 1:55 PM
>To: tkinter-discuss at python.org
>Subject: Re: [Tkinter-discuss] Tkinter Menu
>
>
>Jeff Epler wrote:
>  
>
>>.add_XXX, .insert_XXX, .delete, and .entryconfigure are the methods
>>you can use to incrementally change menus.  If the menu is not a
>>tearoff, the postcommand= may give you a good way to populate the menu
>>when it is about to be shown, rather than anytime its contents would
>>have changed.
>>  
>>    
>>
>Thanks Jeff.
>
>I have a menu with x number of entries. I wanted to delete all the 
>entries except the last two and then rebuild the amended entries.
>
>I couldn't find any way to determine the *number* of entries, or iterate
>
>over them. I ended up keeping a separate list of the entries and calling
>:
>
>menu.delete(0, numMenuItems - 1)
>
>followed by a series of inserts... It works, so I'm not worried. :-)
>
>All the best,
>
>Fuzzyman
>http://www.voidspace.org.uk/python/index.shtml
>  
>
>>Jeff
>>
>>  
>>    
>>
>
>_______________________________________________
>Tkinter-discuss mailing list
>Tkinter-discuss at python.org
>http://mail.python.org/mailman/listinfo/tkinter-discuss
>
>  
>



More information about the Tkinter-discuss mailing list