[PyQt] Problem with Qt.MouseButtons

Hernán Rajchert hrajchert at gmail.com
Mon Nov 12 06:47:26 GMT 2007


Hi, i was doing a little game and when using a QGraphicsRectItem with the
mousePressEvent i tried to capture the event where the player clicks both
left and right click, i've tried the following without luck:

def mousePressEvent(self, event):
             print event.button()               # prints 1
             print QtCore.Qt.RightButton # prints 2
             print QtCore.Qt.LeftButton   # prints 1
             print event.buttons().__int__() # always the same as button()
             print event.buttons().__int__() & QtCore.Qt.RightButton &
QtCore.Qt.LeftButton # Always false, no wonder seeing the line before :P


Best Regards
Hernan Rajchert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071112/1c1a147f/attachment.html


More information about the PyQt mailing list