2011-05-19 78 views

回答

6

檢查你的文檔在PyQt4/doc/html/qt.html#MouseButton-enum

Constant Value 
Qt.NoButton 0x00000000 
Qt.LeftButton 0x00000001 
Qt.RightButton 0x00000002 
Qt.MidButton 0x00000004 
Qt.MiddleButton MidButton 
Qt.XButton1 0x00000008 
Qt.XButton2 0x00000010 

一個簡單的例子:

>>> from PyQt4 import QtCore, QtGui 
>>> app=QtGui.QApplication([]) 
>>> mouse_state=app.mouseButtons() 
>>> mouse_state==QtCore.Qt.NoButton 
True 
>>> int(mouse_state) 
0