I have a list box, I'd like to generate a right click menu for items in
the list box. The problem is unless I left click the item first, I
can't figure out which item in the list I clicked over. So it seems to
me, I need to determine the which item I right clicked over, perform a
setselected on the listbox object and then run my right-click menu.
(I'd like a right-click to also serve as selection)
The originating object is obvioiusly the List box, but I can get the
mouse position from the event.

The problem is, the only thing I can think that might work is to pull
the list font object, calculate the sizes of items in the list and
"guess" which list item is under the mouse. This seems really really

Any suggestions? Should I bind elswhere? Should I just build my own
list box?

I have a control based on wx.Panel something like - no this doesn't
run ;

class myPanel (wx.Panel):
def __init(self):
self.myList = wx.ListBox()
self.myList.foo - populate list

self.myList.Bind(wx.EVT_RIGHT_DOWN, self.ListRIghtClicked)

def ListRightClicked(self,event):

mousePos = event.GetPosition()

# wtf do I do with the position?
magic = doSomething?



Search Discussions

  • Akameswaran at Jan 19, 2006 at 9:46 pm
    In case someone finds this - My own solution to this was to use a
    wx.ListCtrl - it's a bit more work, but the mixin's are quite handy
    for my purposes, also a right click causes selection for ListCtrl - so
    it's nice and clean

    From http Thu Jan 19 22:54:03 2006
    From: http (Paul Rubin)
    Date: 19 Jan 2006 13:54:03 -0800
    Subject: Python on an embedded platform
    References: <z6mdnQ9Y8dm0xFLeRVnygQ@pipex.net>
    Message-ID: <7xek3328as.fsf@ruckus.brouhaha.com>

    Grant Edwards <grante at visi.com> writes:
    JVMs are all around also for ARM processors.
    With footprints in the 100K range?
    For the JVM itself, that's no big deal (look at J2ME). JVM plus
    Python runtime might be harder.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
postedJan 19, '06 at 7:14p
activeJan 19, '06 at 9:46p

1 user in discussion

Akameswaran: 2 posts



site design / logo © 2022 Grokbase