pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Tablet Pressure

Tablet Pressure - 1.3

Eric Pavey (akeric)

Tags:

Description

A class giving you access to tablet pressure data in Pygame.

It requires the "Python Computer Graphics Kit" (cgkit) and specifically its wintab module:

Only works on windows (frown), since its an implementation of the wintab api. See homepage (link below) for pressureTest.py, simple pygame showing example usage (what the screenshot was made with), and other instructions.

Changes

Updated to version 1.3: Realized that I didnā??t need to track mouse position and button-presses in the Tablet class: Pygame (obviously) does all this for you. Solves a lot of problems. Tablet object now only returns back pressure info, which is all we really want from it anyway. The example 'Pressure Test' app has been updated as well to reflect this as well. Simpler, but better! Windows only.

Links

Home Page: http://www.akeric.com/blog/?page_id=798
Source: http://www.akeric.com/python/tablet/tablet_1_3.py

Screenshot


click to view original size

Releases

Tablet Pressure - 1.3 - Nov 4, 2009
Tablet Pressure - 1.0 - Oct 15, 2009

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

November 4, 2009 1:38am - Eric Pavey - nickname: (akeric)
Check out the new v1.3: I *hope* this should now resolve the issues you were having.
October 19, 2009 2:17pm - Eric Pavey - nickname: (akeric)
AH, I bet you're right! The smoke clears ;) It's probably disallowing you from being mapped into the pygame window, since you'd never be able to move back out of it. Although, I'm not sure I know of the fix seeing as I've never used a tablet PC before. But like you first mentioned, changing the example app to make it fullscreen should fix the problem. I've done some research as well into tracking the actual screen-position of the active pygame surface, and once I finish that it should let your stuff work too. In my copious spare time ;)
October 19, 2009 2:09pm - RB[0] - nickname: (roebros)
It had no effect - also tried some other options and some failed while others simply didn't affect anything :S

Perhaps the issue may be that I am using a tablet pc?
October 17, 2009 7:43pm - Eric Pavey - nickname: (akeric)
gar, I just replied, but pygame seemed to erase it. Again, but shorter:
The problem you're describing is exactly the one I was trying to work around having setup the system the way it is: Mapping the tablet space into the pygame screen. But it's weird that yours is staying mapped to the whole screen. I can simulate you problem by adding this immediately after the Context creation:
self.context.options = CXO_SYSTEM
Which turns the context into a "system context", re-mapping it back to the whole windows screen. Maybe you can just try this, immediately after the context is created:
self.context.options = 0
Who knows? :) Indeed, making pressureTest.py fullscreen should resolve the issue, but I'd rather try and find the reason behind why its acting this way. I'm guessing you have some global windows system var set that's different than mine, and its changing the default way our tablets are reporting data. Or something :P
October 17, 2009 1:15pm - RB[0] - nickname: (roebros)
Interesting - well I couldn't find anything better to use.
I did sort of get it to work by getting the max display size and dividing the inextx/y by that instead of my window's size.
But then you would need to offset the x/y pos by the window's position - so I dunno...

I guess best you can do is recommend people use fullscreen mode when using it?
October 15, 2009 10:50pm - RB[0] - nickname: (roebros)
Interesting!
I will look into it sometime tomorrow hopefully :)
October 15, 2009 12:22pm - Eric Pavey - nickname: (akeric)
Interesting: On my machine, it maps the entire extents of my tablet to the extents of the pygame screen. Its physically impossible for me to move the tablet cursor outside that pygame window. Using the mouse though, I regain control for external applications. This is just first pass code, not sure why it would behave differently for you: I'm using these context attrs to query the tablet resolution, then I map that into the pygame screen space:
context.inextx
context.inexty
But maybe I should be using different attrs? (those just happened to work for me). If you want, check the wintab docs, replace those attrs with others and see if it changes your behavior? http://cgkit.sourceforge.net/doc2/wintab.html
October 15, 2009 11:07am - RB[0] - nickname: (roebros) - 4/5
Worked like a charm for me - except (using latest alpha for cgkit) - it assumes the entire display is the bounds for drawing - not the window...

Ie, when I run your example, it is a small(ish) window on my screen - but I can draw by pressing outside of the window - in fact, the far right of my screen is mapped to the far right of the window, instead of it only working while I am over the window...
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Aug 22, 2014

Aug 21, 2014


Aug 19, 2014

Aug 18, 2014

Aug 2, 2014


Jul 28, 2014

Jul 22, 2014

Jul 21, 2014

Jul 20, 2014

Jul 19, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)