Skip to content Skip to sidebar Skip to footer

Handle Touchscreen Gesture In Tkinter

How would I go about installing a handler of touchscreen gestures in Tkinter? I need to something particularly simple: to increase the font size whenever an 'expand' gesture is det

Solution 1:

Tk doesn't support the complex touch events at the moment, and MSDN is very thin on what they actually look like when they come in over the event loop. (It's not something that you're supposed to look at, it seems.) Because Tk intercepts that data at a very low level, it's going to be tricky to integrate.

I can't chase this further. I can see how some of the code works, but way that the samples on MSDN function doesn't match up at all to what Tk's doing. There's a whole framework's worth of mismatch between the two. (I also don't have a device which would support these features; my touch devices don't run Windows and my Windows devices don't support touch input.)

What we would need is someone with a touch-input Win 8 system to run a Tk app that has been hacked (Tk_TranslateWinEvent() in win/tkWinX.c would be the right spot) to print out unrecognised events. We could then see what actually comes over the wire (well, through the master message pump) with touch events; we might hope that they correspond to things involved in the ManipulationStarted, ManipulationUpdated and ManipulationCompleted events, but hope is not always enough. (We might also hope that the events aren't squirrelled in via another route.)

Post a Comment for "Handle Touchscreen Gesture In Tkinter"