I am trying to catch key events in a fullscreen window for showing a slideshow of images.
However I am struggling to catch key events at all under wxPython with GTK on Linux
The following test code catches key events on Windows (Python 2.3.3, wxPython 2.4.2.4)
But on Linux (Python 2.3.3, wxPythonGTK-py2.3-2.4.2.4-1) it fails to catch key events at all.
I read somewhere that you shold catch key events using panels, not frames.
So I tried the following code, which also works on Window, but fails on Linux
I am trying to catch key events in a fullscreen window for showing a slideshow of images.
However I am struggling to catch key events at all under wxPython with GTK on Linux
[...]
But on Linux (Python 2.3.3, wxPythonGTK-py2.3-2.4.2.4-1) it fails to catch key events at all.
I read somewhere that you shold catch key events using panels, not frames.
So I tried the following code, which also works on Window, but fails on Linux
[...]
Key events are delivered to the window with the focus. I think you'll find that if you click on the window that it will then start reporting the key events. For a general fix, call panel.SetFocus()
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Key events are delivered to the window with the focus. I think you'll find that if you click on the window that it will then start reporting the key events. For a general fix, call panel.SetFocus()
Key events are delivered to the window with the focus. I think you'll find that if you click on the window that it will then start reporting the key events. For a general fix, call panel.SetFocus()
Can forms on OS X get key events if the only controls on them are buttons, combos, etc., that don't get focus?
I think so. See the KeyEvents sample in the demo for an example. The Blue panel will change when it has the focus.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I am trying to catch key events in a fullscreen window for showing a slideshow of images.
However I am struggling to catch key events at all under wxPython with GTK on Linux
[...]
But on Linux (Python 2.3.3, wxPythonGTK-py2.3-2.4.2.4-1) it fails to catch key events at all.
I read somewhere that you shold catch key events using panels, not frames.
So I tried the following code, which also works on Window, but fails on Linux
[...]
Key events are delivered to the window with the focus. I think you'll find that if you click on the window that it will then start reporting the key events. For a general fix, call panel.SetFocus()
Thanks for the explanation Robin.
I think the problem was in trying to get the focus I was calling frame.SetFocus() but it didn't get the keypresses... clicking or panel.SetFocus seems to work