[PyQt] Odd key press behavior in PyQt app
gufymike at gmail.com
Fri Mar 4 16:36:10 GMT 2011
On Friday, March 04, 2011 08:03:15 am Umang Varma wrote:
> 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.
I just searched the qt bug tracker for keypress and found an issue, that
might be what you're experiencing. But since I know very few details about it,
I would suggest you go over to it and search for 'keypress' highlighting 'Qt'
and 'Bug', see if any outstanding bugs are similar to yours also.
> > 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
Yeah I do mean C++. I don't know about Jambi, I've probably done the same
amount of Java coding as you've done C/C++.
> 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.
look at this: http://bugreports.qt.nokia.com/browse/QTBUG-17043
That one is marked 'fixed' but will be in some future release.
> 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.
It should allow the menus to work. You're only trying to catch the g and h
keys which are a specific numeric keys, keycodes 42 and 43 respectively using
pc105 us layout kb.
> > 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.
I have discovered that all human evil comes from this, man's being unable
to sit still in a room.
-- Blaise Pascal
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt