Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8318757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:05:20+00:00 2026-06-08T22:05:20+00:00

I’m new to wxPython, so please be gentle. I’m attempting to make virtual list

  • 0

I’m new to wxPython, so please be gentle.

I’m attempting to make virtual list control that is controlled via a context menu popup when the user presses the right mouse button.

From my little bit of experience, it seems that the virtual list control likes to operate with “item” (read: ‘row’) and “column” numbers. Fair enough.

When I receive a right-click event, I can get the row (item) number easy enough by calling event.GetIndex(). But how do I get the column number of the object that was clicked?

import wx
import wx.lib.agw.ultimatelistctrl as ULC

class MyFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Right-click example")
        self.list = MyListCtrl(parent=self)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.list, 1, wx.EXPAND)
        self.SetSizer(sizer)

class MyListCtrl(ULC.UltimateListCtrl):
     def __init__(self, parent, *args, **kwargs):
         ULC.UltimateListCtrl.__init__(self, parent, 1, agwStyle=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_HRULES|wx.LC_VRULES)

        self.InsertColumn(0, "Column0")
        self.InsertColumn(1, "Column1")
        self.SetItemCount(5)
        # Bindings
        self.Bind(ULC.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightClick)

    def OnGetItemText(self, item, column):
        return "%d, %d" % (item, column)

    def OnGetItemToolTip(self, item, column):
        pass

    def OnGetItemTextColour(self, item, column):
        pass

    def OnRightClick(self, event):
        # Get the index (i.e. which row was clicked)
        print("OnColRightClick: GetIndex = %r\n" %(event.GetIndex()))
        # How can I get which column was clicked?

if __name__ == "__main__":
    # Start the GUI
    app = wx.App()
    frame = MyFrame()
    app.SetTopWindow(frame)
    frame.Show()
    app.MainLoop()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:05:22+00:00Added an answer on June 8, 2026 at 10:05 pm

    Sadly there is not a good way to get the column information. I did find this discussion on the matter though: http://wxpython-users.1045709.n5.nabble.com/Getting-row-col-of-selected-cell-in-ListCtrl-td2360831.html

    It sounds like you’d have to calculate it yourself. According to Robin, there’s some code in wx.lib.mixins.listctrl.TextEditMixin that might help. I also found the recipe for ObjectListView (a wrapper for ListCtrl) that also might help: http://code.activestate.com/recipes/577543-objectlistview-getcolumnclickedevent-handler/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.