[PyQt] Odd key press behavior in PyQt app

Umang Varma umang.me at gmail.com
Fri Mar 4 16:04:08 GMT 2011


Thanks so much for your response!

On 03/04/2011 12:55 AM, Mike Ramirez wrote:
> A few things missing, pyqt version, sip version, qt version (I think
> these are required to figure out where/how this bug was introduced or if
> a simple upgrade will remove the bugs, phil, pete and the rest do a lot
> of updates/fixes constantly).

I can see this bug in PyQt 4.7.2. The user who reported the bug is
almost certainly using 4.7.4 or newer, but hasn't explicitly said so.
I'm using sip (python-sip package on Ubuntu) 4.10.1, Qt (libqt4-*
packages on Ubuntu) 4.6.2.

> Also some Ideas.
> 
> I'm not sure if this is a Qt or PyQt problem. I would suggest building a
> Qt program and see if it's reproducable in Qt. If it's a problem in Qt
> then this would go to nokia.
By this you mean coding in C/C++, right? I'm not fully confident of
that. I'm more comfortable with Java. Would I get anywhere if I tried
using Jambi maybe? I haven't done any GUI coding in Java before, but I
have done almost no coding in C/C++ so Java would be better for me
personally.

Also, since this bug is not easily reproducible, I sometimes cannot even
get my python version to reproduce the bug. I have the strong feeling
that it is only after a certain sequence of actions on the game that
this bug shows up (I'd love to know what that sequence is, since that
/might/ make it more easily reproducible). I have never encountered this
bug when I first launch the game. It is only after multiple new games
(with a combination of the Ctrl+N keyboard shortcut and using the mouse
to click the menu item) that I feel this bug surfaces. This means I
would have to code my game fully in Java in order to check whether the
bug exists or not.

This seems a little difficult, but I could try doing this in a few
weeks, when I'm not as busy with other things as I am now.

> I'm not sure how to work around this with 100% success or breaking the
> menus, without playing with it, but I would start with catching the
> event and checking if there is an active game and the keypress is a g/h
> in it and then pass it to the game, This breaks the menu keypresses
> though, It might be acceptable, if you only do this explicitly during an
> active game. Which is probably better than what you have now.

Would I then be able to let the menus work if the user press Alt+G or
Alt+H? Since this would shake a lot of my code around, I'll think about
doing this only if more people are affected by this bug, or (for
whatever reason), this bug becomes more reproducible than it is now.

> I'm not familiar with the internal details of the keypress event enough
> to tell if this would work like it sounds. But hopefully this gets you
> started.

Thanks again for your response! It would be great if you could let me
know what you think of the above.

Umang


More information about the PyQt mailing list