
Dear Chimera Dev Team, I created a new item in the menu bar but my question now is how can I put options in the new bar? As you know, to put any option in the menu 'Tools' we "only" have to copy the new folder in chimera/share/ . I'm trying to do the same with my new item but the only way that I found to do so is modifying the ChimeraExtension.py file of VolumeMenu. Exists any other possibility much easier than that? Thanks. Elisabeth Ortega Universitat Autònoma de Barcelona (UAB)

Hi Elisabeth, If you're still using tkgui.addMenu, that returns a Tkinter.Menu instance. You add an item to the menu with: menu.add_command(label="menu item name", command=myFunc) which will cause myFunc to get called (with no arguments) when that menu item is selected. There's a lot of documentation available for the Tkinter.Menu class, just Google "Tkinter menu". I personally use: http://infohost.nmt.edu/tcc/help/pubs/tkinter/ but that may or may not be overkill for your purposes. Also, Chimera's tkgui._createMenus function shows a lot of uses of Tkinter.Menu instances. --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu On Jan 24, 2011, at 10:40 AM, Elisabeth Ortega wrote:
Dear Chimera Dev Team,
I created a new item in the menu bar but my question now is how can I put options in the new bar? As you know, to put any option in the menu 'Tools' we "only" have to copy the new folder in chimera/ share/ . I'm trying to do the same with my new item but the only way that I found to do so is modifying the ChimeraExtension.py file of VolumeMenu. Exists any other possibility much easier than that?

A few more Tkinter links: http://effbot.org/tkinterbook/tkinter-index.htm http://effbot.org/tkinterbook/menu.htm http://docs.python.org/library/tkinter.html http://tkinter.unpythonic.net/wiki/ http://tkinter.unpythonic.net/wiki/Widgets http://tkinter.unpythonic.net/wiki/Widgets/Menu -- Darren On 01/25/2011 10:35 AM, Eric Pettersen wrote:
Hi Elisabeth, If you're still using tkgui.addMenu, that returns a Tkinter.Menu instance. You add an item to the menu with:
menu.add_command(label="menu item name", command=myFunc)
which will cause myFunc to get called (with no arguments) when that menu item is selected. There's a lot of documentation available for the Tkinter.Menu class, just Google "Tkinter menu". I personally use:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/
but that may or may not be overkill for your purposes. Also, Chimera's tkgui._createMenus function shows a lot of uses of Tkinter.Menu instances.
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
On Jan 24, 2011, at 10:40 AM, Elisabeth Ortega wrote:
Dear Chimera Dev Team,
I created a new item in the menu bar but my question now is how can I put options in the new bar? As you know, to put any option in the menu 'Tools' we "only" have to copy the new folder in chimera/share/ . I'm trying to do the same with my new item but the only way that I found to do so is modifying the ChimeraExtension.py file of VolumeMenu. Exists any other possibility much easier than that?
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
participants (3)
-
Darren Weber
-
Elisabeth Ortega
-
Eric Pettersen