Popup menus without an associated window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rich Churcher

    #1

    Popup menus without an associated window

    Is there a way using any of the Python UI toolkits to generate popup
    menus outside the context of an application? For example,
    middle-clicking on the desktop shows a list of shortcuts to choose
    from.

    Pointers to source examples would be appreciated.

    --
    Cheers,
    Rich.

  • Miki Tebeka

    #2
    Re: Popup menus without an associated window

    Hello Rich,[color=blue]
    > Is there a way using any of the Python UI toolkits to generate popup
    > menus outside the context of an application? For example,
    > middle-clicking on the desktop shows a list of shortcuts to choose
    > from.
    >
    > Pointers to source examples would be appreciated.[/color]

    wxPython:

    import wx

    class Hidden(wx.Dialo g):
    def __init__(self):
    wx.Dialog.__ini t__(self, None, -1)
    self.menu = wx.Menu()
    def add(title):
    item = self.menu.Appen d(-1, title)
    return item.GetId()

    self.ids = {}

    for title in ["One", "Two", "Three"]:
    self.ids[add(title)] = title

    self.Bind(wx.EV T_MENU, self.OnPopup)

    def Go(self):
    self.PopupMenu( self.menu)

    def OnPopup(self, evt):
    print "You selected %s" % (self.ids[evt.GetId()])

    app = wx.PySimpleApp( )
    dlg = Hidden()
    dlg.Go()
    dlg.Destroy()


    HTH,
    --
    ------------------------------------------------------------------------
    Miki Tebeka <mtebeka@qualco mm.com>

    The only difference between children and adults is the price of the toys

    Comment

    • Rich Churcher

      #3
      Re: Popup menus without an associated window

      > HTH,

      Wonderful Miki, thank you very much!

      --
      Cheers,
      Rich.

      Comment

      Working...