[PyKDE] hardware_keycode

Jim Bublitz jbublitz at nwinternet.com
Fri Dec 19 19:02:00 GMT 2003


On Friday December 19 2003 02:10, Laur Ivan wrote:
> On Wednesday 17 December 2003 18:03, Jim Bublitz wrote:
> > On Wednesday December 17 2003 09:09, Laur Ivan wrote:
> > >  Is there any way to get the hardware_keycode as provided
> > > by Xevent in pyqt/pykde? I've been looking on google for
> > > the past 3 days to no avail...

> > Probably not, unless PyQt or PyKDE provide a method to
> > return it. XEvent and other X classes don't have Python
> > bindings.

> PyKDE has something called "KKeyNative" which is supposed to
> get the hardware_keycode as well, but i have quite a few
> problems on compiling 3.8 (pykde) on Fedora. PyQt does not
> bind the x11event methods from QApplication (3.8 again).

I'm not aware of the problems with Fedora (although I am aware 
there are some build problems with PyKDE 3.8) - those can 
probably be worked through without too much difficulty. However, 
if the only thing you'd need from PyKDE is KKeyNative, that 
seems like a poor reason to use PyKDE. You'd be loading a lot of 
lib code for one or two methods.

> > The easiest solution might be to write your own Python
> > extension in C/C++ to get it. What is it and what is it used
> > for?

> This would be quite unfortunate as I'd need to tap in the
> QApplication. I'd probably could write a class inheriting
> QApplication and make accessible its x11* ... If so, The silly
> question comes: how do I actually write the bindings..? :)

If you need to hook into QApplication, it becomes more difficult. 
You can look at pykdepanelapplet/pythonize in PyKDE to see 
what's involved, but that code may not even be relevant. I was 
overlooking the fact that you might need to hook into the 
event-loop to accomplish what you're trying to do.

What exactly do you want to accomplish? For example, why isn't 
QKeyEvent::key() sufficient?

Jim




More information about the PyQt mailing list