No, I'm pretty sure SDL does not have any pressure support. Although I
think that pressure sensitivity and multitouch may be planned for SDL
1.3/2.0, (maybe somebody can correct me if I am mistaken on that)
I remember hearing a rumor that pygtk supports pressure sensitivity, but
making pygame and pygtk work together might prove to be more trouble
than it is worth.
Also, some quick googling turns up pymt, which might be helpful, but I
haven't tried it myself.
---
James
<Packet btns:1 x:10937 y:2140> 0 0With the last two values representing pressure. Well, it's a start ;)
# pressure.py
import os
import pygame
from cgkit import wintab
pygame.init()
hwnd = 1024
os.environ["SDL_WINDOWID"] = str(hwnd)
def main():
screen = pygame.display.set_mode((640, 480))
background = pygame.surface.Surface(screen.get_size())
background.fill(pygame.color.Color("Black"))
screen.blit(background, (0,0))
#--------------------------------------------
# Creates a "Context" object:
tablet = wintab.Context()
tablet.open(hwnd, True)
looping = True
while looping:
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
# allow for exit:
looping = False
#--------------------------------------------
# Get a tuple of range of packets captured: (first, last)
packetExtents = tablet.queuePacketsEx()
if packetExtents[1] is not None:
# This is a sub-list of Packet objects:
packets = tablet.packetsGet(packetExtents[1])
# Get the last Packet object:
packet = packets[-1]
# Print packet info, and pressure data:
print packet, packet.normalpressure, packet.tangentpressure
pygame.display.flip()
pygame.quit()
if __name__ == "__main__":
main()