Issue
I'm using Python 2.7 with PySide and want to use this to retrieve pen pressure from my wacom pen.
So I tried setting up the following
import PySide
from PySide import QtCore, QtGui
pressure = PySide.QtGui.QTabletEvent.pressure()
print pressure
That threw the following error
pressure = PySide.QtGui.QTabletEvent.pressure()
TypeError: descriptor 'pressure' of 'PySide.QtGui.QTabletEvent' object needs an argument
The object it needs is a "PySide.QtGui.QTabletEvent" Object. But I have no idea how can I retrieve such an object.
So my question is, how do I retrieve the wacom penpressure using QTabletEvent?
Solution
You need to receive the actual event and obtain the pressure
from it.
Example:
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_()
Answered By - Oleh Prypin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.