开发者

Python Wacom Interface

I am trying to write a python script on Windows 7 to interact with my Wacom Bamboo Pen tablet. Wacom recommends using the WinTab API, and it works fine, but not for my application. I don't want the Wacom tablet to act as a pointing device (as in, it should not move the cursor). All I want is raw x, y data from the device.

What is the best way to implement this? Do I have to write a different driver for the tablet to allow this? Or can I modify the existing Wacom driver to not a开发者_运维问答ffect the system cursor.


I think, in wintab you can get the raw coordinates. At least in Python wrapper for wintab you can access them:

cgkit.wintab.Packet.x

In absolute mode, contains the scaled cursor location along the x axis. In relative mode, contains the scaled change in cursor position.

cgkit.wintab.Packet.y

In absolute mode, contains the scaled cursor location along the y axis. In relative mode, contains the scaled change in cursor position.

I'm investigating for myself if there is an cross-platform api for tablets, but if you need windows-only solution that should work.


Although its not related to the question (other than Wacom) some readers might find this useful:

https://boutiqueretouching.com/fix-wacom-lag/

Advice: Attach your pen to your tablet with string (Or always store your wacom pen in its dock)... This stops your family mistaking it for a dried up felt tip, and throwing it in the bin. (Did this myself once when tidying up - agh!)


As mentioned before you have to use Python Computer Graphics Kit cgkit. If you don't want to build it from source and don't mind using older version of Python you can use the binaries.

The version tested in Windows works with Python 3.2 32-bit. Download and install Python from here Then download and install Python Computer Graphics Kit from here

Test if Wintab driver is available by running the following 2 lines

from cgkit import wintab
print(wintab.available())

If you get False then you have to install the drivers. You can download the drivers from here

Restart the computer after installing the drivers and try the 2 lines again you should get True.

Now to retrieve stylus data refer to Python wrapper for wintab

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜