Hello Rich,
> 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.

wxPython:

import wx

class Hidden(wx.Dialog):
     def __init__(self):
         wx.Dialog.__init__(self, None, -1)
         self.menu = wx.Menu()
         def add(title):
             item = self.menu.Append(-1, title)
             return item.GetId()

         self.ids = {}

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

         self.Bind(wx.EVT_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 <[EMAIL PROTECTED]>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to