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 6200673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:24:43+00:00 2026-05-24T04:24:43+00:00

So, I have a wxPython ListCtrl which contains rows of data. How can I

  • 0

So, I have a wxPython ListCtrl which contains rows of data. How can I make an event that calls a function, with the row contents, when one of the rows if clicked on?

  • 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-05-24T04:24:44+00:00Added an answer on May 24, 2026 at 4:24 am

    You can use the Bind function to bind a method to an event. For example,

    import wx
    
    class MainWidget(wx.Frame):
    
        def __init__(self, parent, title):
            super(MainWidget, self).__init__(parent, title=title)
    
            self.list = wx.ListCtrl(parent=self)
            for i,j in enumerate('abcdef'):
                self.list.InsertStringItem(i,j)
            self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnClick, self.list)
    
            self.Layout()
    
        def OnClick(self, event):
            print event.GetText()
    
    
    
    if __name__ == '__main__':
        app = wx.App(redirect=False)
        frame = MainWidget(None, "ListCtrl Test")
        frame.Show(True)
        app.MainLoop()
    

    This app will print the item in the ListCtrl that is activated (by pressing enter or double-clicking). If you just want to catch a single click event, you could use wx.EVT_LIST_ITEM_SELECTED.

    The important point is that the Bind function specifies the method to be called when a particular event happens. See the section in the wxPython Getting Started guide on event handling. Also see the docs on ListCtrl for the events that widget uses.

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

Sidebar

Related Questions

in wxpython, is there a event that can occur when one of the function
I have a little logging app (written in wxPython) that receives data from a
I have a wxPython app which has many worker threads, idle event cycles, and
I have wxPython app which is running on MS Windows and I'd like it
I have a wxPython application that relies on an external config file. I want
I have a wxPython ListCtrl with five columns. Four of these hold strings, the
Does wxPython have a version for Python 3? If it does, where can I
I have a wxPython application that sends multipart emails with HTML and embedded images.
I have a wxPython application ( http://www.OpenSTV.org ) that counts ballots using methods that
I have a wxPython which works perfectly on window xp theme but on switching

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.