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

  • Home
  • SEARCH
  • 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 7890695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:25:21+00:00 2026-06-03T06:25:21+00:00

What event is called when the caret inside a TextCtrl / Styled TextCtrl has

  • 0

What event is called when the caret inside a TextCtrl / Styled TextCtrl has its position changed? I need to bind the event to show in the status bar, the current position of the caret.

  • 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-03T06:25:23+00:00Added an answer on June 3, 2026 at 6:25 am

    Try binding the wx.EVT_KEY_UP event with the wx.TextCtrl object like this:

    import wx
    
    class MyForm(wx.Frame):
    
        def __init__(self):
            wx.Frame.__init__(self, None, wx.ID_ANY, "Show Caret Position", size=(400, 140))
            panel = wx.Panel(self, wx.ID_ANY)
            sizer = wx.BoxSizer(wx.VERTICAL)
            text = wx.StaticText(panel, -1, "Text:", (10, 22))
            self.textCtrl = wx.TextCtrl(
                    panel,
                    -1, "",
                    (50,5),
                    size=(250, 50),
                    style=wx.TE_MULTILINE
                )
            self.textCtrl.SetInsertionPoint(0)
            self.textCtrl.Bind(wx.EVT_KEY_UP,self.onTextKeyEvent)
            self.textCtrl.Bind(wx.EVT_LEFT_UP,self.onTextKeyEvent)
            self.statusbar = self.CreateStatusBar(1)
            panel.SetSizerAndFit(sizer, wx.VERTICAL)
    
        def onTextKeyEvent(self, event):
            statusText = "Caret Position: "+str(self.textCtrl.GetInsertionPoint())
            self.SetStatusText(statusText,0)
            event.Skip()
    
    
    #Run application
    if __name__ == "__main__":
        app = wx.PySimpleApp()
        frame = MyForm()
        frame.Show()
        app.MainLoop()
    

    I’ve tested on Windows 7 environment with Python 2.7 + wxPython 2.8.

    Here is how it should look like

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

Sidebar

Related Questions

I have a table called Event. A column has duration--which is...how long that event
I created a custom event called slides.swap but I want to prevent the event
I have an onclick event called in a PHP foreach loop for several items
How can I check which event called my function on JavaScript with jQuery? Like
Is there anyway I can use native javascript to fire an event called onmove
When you update DataGridView.DataSource using the assignment operator, the DataSourceChanged event handler is called.
Why does an event handler never get called if it's added within a loop
I have this code which is called at an onChange event of an function
I've got a method that gets called on an event, which presents me with
-I want to raise an event whenever method showmessage is called.I want to catch

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.