question about wxpython CtrlList event binder: wx.EVT_LIST_ITEM_RIGHT_CLICK

Mike Driscoll kyosohma at
Tue Apr 21 23:24:16 CEST 2009

On Apr 21, 3:35 pm, Kent <kent.y... at> wrote:
> Hi there,
> I wrote a desktop application with wxPython2.8. And got a problem.
> Hope here someone can give some hint. Thanks in advance.

I recommend joining the wxPython mailing list and posting there. The
guys there are great and can probably help you out. See

> There was a ListCtrl (lc) in my GUI, and it was a bit long, so that
> there would be some blank space below ("empty area") in case there
> were only a few items.
> I bind a function on the event wx.EVT_LIST_ITEM_RIGHT_CLICK, when user
> rightclick on the lc item, my function was triggered, and open a popup
> menu.
> Depends on the item user clicked, the menu items can be different. I
> checked the event.getData(), to decide which menu item will show to
> user. That is, if user right click on the "empty area", the
> event.getData() will be 0. I wrote the appl. under Linux, and tested,
> it worked as what I expected.
> However, today someone reported a bug, said, under Windows XP, right
> clicking on the items of lc, it works fine, but if on the "empty area"
> of the lc, nothing happened, no popup menu. I tested under WINXP, the
> function was not triggered at all when I right-clicked on the "empty
> area".
> I tried to bind wx.EVT_RIGHT_DOWN(UP) to the lc, but the function
> cannot be triggered under Linux.  any suggestion?
> Thanks
> regards,
> Kent

If you join the wxPython list, they'll probably ask for a small
runnable sample. Here's some instructions for how to do that:

It would be good to know what mode you are using for your ListCtrl.
List view, report, icon or what? The demo doesn't have any white space
at the end, so I can't test this easily. Are you using a sizer to hold
the widget?

- Mike

More information about the Python-list mailing list