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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:03:39+00:00 2026-05-11T04:03:39+00:00

Coming from this question , I have a wxComboCtrl with a custom popup made

  • 0

Coming from this question, I have a wxComboCtrl with a custom popup made of a panel with a bunch of radiobuttons.. My problem is that when I open the popup the combo doesn’t get keystrokes, because the events get handled by the panel itself.. I’d like to redirect those KeyEvents to the textctrl of the combo, but I can’t find a way to get it to work :/
Am I going the wrong way? Should I manually handle the textctrl value as the user presses keys? I think that would be a bit cumbersome though.. Since supposedly the textctrl already knows how to handle those events..

Here’s my testcase (wxPython 2.8 on Linux), the "on_key" method should be the culprit:

import wx import wx.combo  class CustomPopup(wx.combo.ComboPopup):          def Create(self, parent):         # Create the popup with a bunch of radiobuttons         self.panel = wx.Panel(parent)         sizer = wx.GridSizer(cols=2)         for x in range(10):             r = wx.RadioButton(self.panel, label="Element "+str(x))             r.Bind(wx.EVT_RADIOBUTTON, self.on_selection)             sizer.Add(r)         self.panel.SetSizer(sizer)                  # Handle keyevents         self.panel.Bind(wx.EVT_KEY_UP, self.on_key)      def GetControl(self):         return self.panel      def GetAdjustedSize(self, minWidth, prefHeight, maxHeight):         return wx.Size(200, 150)      def on_key(self, evt):         if evt.GetEventObject() is self.panel:             # Trying to redirect the key event to the combo.. But this always returns false :(             print self.GetCombo().GetTextCtrl().GetEventHandler().ProcessEvent(evt)         evt.Skip()      def on_selection(self, evt):         self.Dismiss()         wx.MessageBox("Selection made")   class CustomFrame(wx.Frame):      def __init__(self):         # Toolbar-shaped frame with a ComboCtrl         wx.Frame.__init__(self, None, -1, "Test", size=(800,50))         combo = wx.combo.ComboCtrl(self)         popup = CustomPopup()         combo.SetPopupControl(popup)                  sizer = wx.BoxSizer(wx.VERTICAL)         sizer.Add(combo, 0)         self.SetSizer(sizer)         self.Layout()  if __name__ == '__main__':     app = wx.PySimpleApp()     CustomFrame().Show()     app.MainLoop() 

Edit:
I found these (unresolved) discussions on the same topic..
"ComboCtrl loses keyboard focus when ComboPopup is shown "
"issue using wx.ComboCtrl"

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

    I’ve got an answer from Robin Dunn himself on wxpython-users:

    Sending low-level events to native widgets like this does not work the way that most people expect it to. You are expecting this to result in the character being added to the text ctrl,but it can’t do that because all that ProcessEvent does is send the wx.Event to any bound event handlers and then it stops. It does not go to the next step and convert that event to the equivalent native message and send it on to the native widget. See the ‘Simulating keyboard events’ thread.

    It doesn’t work especially well on non-Windows platforms, but you could try calling EmulateKeypress instead.

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

Sidebar

Ask A Question

Stats

  • Questions 178k
  • Answers 178k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer from http://msdn.microsoft.com/en-us/library/system.diagnostics.process(VS.71).aspx using System; using System.Diagnostics; using System.ComponentModel; namespace MyProcessSample… May 12, 2026 at 3:39 pm
  • Editorial Team
    Editorial Team added an answer In JavaScript, strings are immutable, which means the best you… May 12, 2026 at 3:39 pm
  • Editorial Team
    Editorial Team added an answer I understand this to be heirarchical. Meaning Critical logs only… May 12, 2026 at 3:39 pm

Related Questions

I know this question has been asked a bit before. But looking around I
I have a table of data, and I allow people to add meta data
I have a Web Reference to a remote Web Service, which is called in
I am new to programming in general so please keep that in mind when

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.