[PyQt] Why can I rotate a GraphicsItem only once?
In a game the user should be able to rotate a GraphicsItem by clicking on it with the right mouse button. According the game situation he must be able to execute another rotation by the same angle (90°). But this time the item is not rotated! To explain the situation I add the essential part of my code: class Stone(QGraphicsPolygonItem): def __init__(self,polygon,brush,x,y,scene): QGraphicsPolygonItem.__init__(self,polygon,None,scene) self.setPos(x,y) self.setBrush(brush) def mousePressEvent(self,ev): if ev.button()==Qt.RightButton: print self.sceneBoundingRect() self.setRotation(90) print self.sceneBoundingRect() Two consecutive clicks produce the following output: PyQt4.QtCore.QRectF(5.0, 41.0, 90.0, 18.0) PyQt4.QtCore.QRectF(41.0, 5.0, 18.0, 90.0) PyQt4.QtCore.QRectF(41.0, 5.0, 18.0, 90.0) PyQt4.QtCore.QRectF(41.0, 5.0, 18.0, 90.0) This demonstrates that the second click fails and this can also be watched on the screen. What am I doing wrong? I ask for a solution because consecutive rotations are essential for the game. Cheers Konrad PS: For demonstration in this example the polygon is a rectangle, in other cases the polygons haves more edges, ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Why can I rotate a GraphicsItem only once?
Konrad wrote: In a game the user should be able to rotate a GraphicsItem by clicking on it with the right mouse button. According the game situation he must be able to execute another rotation by the same angle (90°). But this time the item is not rotated! Philippe Crave answered: seems that setRotation() sets an absolute value, not an increment. if you want to add 90°, you should do something like self.setRotation(self.rotation()+90) Konrad writes: This is the solution. Many thanks to Philippe for his answer! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] ANN: eric 4.4.7 released
Hi, I just uploaded eric 4.4.7. It is a maintenance release fixing some bugs. It is available via the eric web site. http://eric-ide.python-projects.org/index.html Regards, Detlev -- Detlev Offenbach det...@die-offenbachs.de ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] ANN: eric 5.0.1 released
Hi, I just uploaded eric 5.0.1. It is a maintenance release fixing some bugs. It is available via the eric web site. http://eric-ide.python-projects.org/index.html Regards, Detlev -- Detlev Offenbach det...@die-offenbachs.de ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] pyqt behavior change
Hello, i don't know if this is a bug or an intended behavior but i am using in my machine Arch Linux pyqt 4.7.4 with sip 4.10.5 and in older versions the behavior was: combo = QComboBox() if combo: print exists else: print is none would print exists and now it prints is none, i suppose it is a bug because the same test with QLabel still print exists, i have not tested other classes though. Regards, Miguel Angel. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] embedding a windows application in a qwidget
hello group, came across a nice feature in gtk that embeds applications in a gtk widget using the xembed protocol. i looked around to see if (py)qt has similars. windows users are not so fortunate however. i learned about a SetParent win32 api call ( http://msdn.microsoft.com/en-us/library/ms633541(VS.85).aspx). and that qt can return a native window id. so i came up with the following code (which does not work, mind you :) ) anyone who knows better has an idea how it can be accomplished? thanks a lot in advance = import sys import ctypes import subprocess from PyQt4 import QtGui if __name__ == '__main__': app = QtGui.QApplication(sys.argv) process = subprocess.Popen(['c:/vim/vim72/gvim.exe']) # this call is to get the process window handle SYNCHRONIZE = 0x0010 handle = ctypes.windll.kernel32.OpenProcess( SYNCHRONIZE, False, process.pid ) w = QtGui.QWidget() wid = w.winId() # this one turns out to be an void* c type, might be the culprit w.show() ctypes.windll.user32.SetParent(handle, int(wid)) sys.exit(app.exec_()) -- victor ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] embedding a windows application in a qwidget
Perhaps you have to make sure that you have a native window. Look for alien widgets on Qt, e.g. http://labs.trolltech.com/blogs/2007/08/30/say-goodbye-to-flicker-aliens-are-here-to-stay/ Henning ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyqt behavior change
On Sun, 01 Aug 2010 19:49:11 +0200, Linos i...@linos.es wrote: Hello, i don't know if this is a bug or an intended behavior but i am using in my machine Arch Linux pyqt 4.7.4 with sip 4.10.5 and in older versions the behavior was: combo = QComboBox() if combo: print exists else: print is none would print exists and now it prints is none, i suppose it is a bug because the same test with QLabel still print exists, i have not tested other classes though. It's a side effect of an intended change that is triggering a bug in your code. QComboBox() now has a __len__() method which changes the behaviour of if combo. If you want to test for None then you should always do so explicitly... if combo is None: print is none else: print exists Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Still (apparently) having version issues
I have Python 2.6.2 installed. I have installed PyQt-Py2.6-gpl-4.7.4-1. I have also installed dip-p2-gpl-0.2-snapshot-6de9307b5575. I am attempting the example on p9 of the dip documentation (The Smallest Example). I have typed the code in (as opposed to downloading it) and get the following error when I run it: wres12386#1(~/Test)$ python test.py Traceback (most recent call last): File test.py, line 5, in module from dip.ui import Form File c:\Python26\lib\site-packages\dip\__init__.py, line 34, in module raise ValueError(PyQt QString API v2 is required) ValueError: PyQt QString API v2 is required [exited with 1] From this I assume I still have version issue incompatibilities? Could somebody point out which package I have wrong? Thanks Peter P.S. I have attempted running the same code from the dip distribution in doc/examples/ui/simple.py - after I correct the app.exec() (what has changed that all the code makes a method call that is not in the library???) line it gives exactly the same error message. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt