我正在使用Python2.7和PySide,并且想使用this来恢复我的wacom笔的笔压。
因此,我尝试设置以下内容
import PySide
from PySide import QtCore, QtGui
pressure = PySide.QtGui.QTabletEvent.pressure()
print pressure它抛出了以下错误
pressure = PySide.QtGui.QTabletEvent.pressure()
TypeError: descriptor 'pressure' of 'PySide.QtGui.QTabletEvent' object needs an argument它需要的对象是一个"PySide.QtGui.QTabletEvent“对象。但我不知道如何检索这样的对象。
所以我的问题是,如何使用QTabletEvent检索wacom penpressure?
发布于 2012-08-31 20:09:56
您需要接收实际的事件并从中获取pressure。
示例:
import sys
from PySide import QtCore, QtGui
class MyWidget(QtGui.QWidget):
def tabletEvent(self, e):
print(e.pressure())
app = QtGui.QApplication(sys.argv)
widget = MyWidget()
widget.show()
app.exec_()https://stackoverflow.com/questions/12215008
复制相似问题