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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:43:07+00:00 2026-06-12T08:43:07+00:00

I have an OpenGL wxpython app that I’m trying to get working in Ubuntu.

  • 0

I have an OpenGL wxpython app that I’m trying to get working in Ubuntu. It was developed (by someone else) on Mac OSX, and works just fine there.

The last outstanding problem I have is that keyboard events aren’t getting captured.

The code looks something like this:

class GLFrame(wx.Frame):
     def __init__(...):
         ...
         self.canvas.Bind(wx.EVT_MOTION, self.mouseMotion)
         self.canvas.Bind(wx.EVT_CHAR, self.character)
         ...

def character(self, evt):
    print "EVT_CHAR"
    # do stuff

def mouseMotion(self, evt):
    print "EVT_MOTION"
    # do stuff

I’ve grepped the entire codebase for Bind calls, and nothing else is using EVT_CHAR, EVT_KET_DOWN or EVT_KEY_UP. I’ve also tried both EVT_KEY_DOWN and EVT_KEY_UP, and neither of them work.

I’ve also tried changing the bind calls from

self.canvas.Bind(...)

to

self.Bind(...)

This breaks EVT_MOTION, and the EVT_CHAR callback still doesn’t get called.

Are there any calls that might capture keyboard events before they get to GLFrame? I’m new to wxpython, and while it mostly makes sense to me, I’m sure there are ‘gotchas’ that I am unaware of.

  • 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-12T08:43:08+00:00Added an answer on June 12, 2026 at 8:43 am

    According to the wxpython Google group, whether or not wx.Frame receives keyboard events is implementation-dependent. The Ubuntu implementation does not receive them.

    From: https://groups.google.com/d/msg/wxpython-users/dF2gf5KvFhE/M_-aRuG3aWUJ

    Whether wx.Frames are able to catch key events is not defined by wx and
    therefore implementation dependent. The fact that it may work on some
    platforms is basically just a happy coincidence. I’m not sure about the
    GLCanvas class, but I would expect it to be able to if it has the focus.
    You may want to double check where the focus is at by doing something
    like “print wx.Window.FindFocus()” from a timer or something.

    Turns out, the GLCanvas can receive keyboard events just fine. For whatever reason, it wasn’t getting focus. Calling

    self.canvas.SetFocus()
    

    fixed the problem.

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

Sidebar

Related Questions

I have a Opengl ES 1.x ANdroid 1.5 app that shows a Square with
I am working on iPhone app and I have an openGL view rendering on
I have an OpenGL application that outputs stereoscopic 3D video to off-the-shelf TVs via
Here's the basic situation: I have an OpenGL VBO that draws a 2D symbol
I have been researching OpenGL programming on Mac OS X. While a fair amount
I have an OpenGL view that I would like to manually modify and redraw
I have an opengl application that loads a dxf and draws it on the
I have built an OpenGL Viewer control that can simply be dropped onto a
I have a Cocos2d/openGL iPhone game. It's a universal app and I'm dealing with
I have an OpenGL-program using GLSL, that I can run just fine with the

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.