On Thu, 2005-08-11 at 22:30 -0600, Don Allingham wrote:
> Is there a way to use a MenuToolButton with UIManager?
> 
> I would like to do something like:
> 
> <toolbar name="Toolbar">
>   <toolitem action="Button">
>     <menuitem action="Entry1">
>     <menuitem action="Entry2">
>   </toolitem>
> </toolbar>
> 
In my pre-uimanager code I achieved this type of thing with a callback
from the toolitem to popup the new menu.  That piece of UI was discarded
before I converted to uimanager so it may or may not be the only way to
achieve this.

The following is untested but should work:

In the uimanager xml define a stand-alone menu.
  <menu name="ButtonPopupMenu">
    <menuitem action="Entry1">
    <menuitem action="Entry2">
  </menu>

Create your actiongroups for the toolbar Button and Entry1 and Entry2 as
normal.

Then in the callack for "Button", instantiate that popup menu:
  def Button_cb():
      buttonMenu = uimanager.get_widget('/ButtonPopupMenu')
      buttomMenu.popup(None, None, None, 0,
                       gtk.get_current_event_time())

-Toshio

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to