[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] touchscreen laptops with pygame



Hi Caroline,

I am also doing research studies with Pygame and I also used a touchscreen once. I had the exact same problem. For me, the solution was to NOT use a fullscreen display, but a window (you can make it the same size of the screen and then position it in such way on the screen, that the window decorations cannot be seen).

Hope this helps,
Florian

Btw: You might also want to have a look at a framework I am developing (based on Pygame) for creating and conducting experiments: http://www.expyriment.googlecode.com


On Thu, Apr 28, 2011 at 11:57 AM, René Dudfield <renesd@xxxxxxxxx> wrote:
Hi,

what version of windows are you using?

cheers,


On Thu, Apr 28, 2011 at 10:49 AM, Witton, Caroline <c.witton@xxxxxxxxxxx> wrote:

Dear pygame-users,

 

I’m writing some basic pygame programs for use in a research study with children in schools and I would like to start using a touchscreen laptop with them.  My code works fine with a standard mouse but I’m getting strange errors when I try with a touchscreen monitor – I would be grateful for any advice at all.

 

The problem is that the mouse position co-ordinates I get from the touchscreen don’t bear any relation to what I get with a standard mouse.  Its a USB HID touchscreen so I had expected it to act like a mouse with one button.  But, for example, the following section of code prints appropriate mouse co-ordinates if I click the ‘normal’ mouse, but strange (meaningless?) co-ordinates if I touch the touchscreen, even though the mousemotion and mouse button events are identified as the correct type.

 

for event in pygame.event.get():

            print pygame.event.event_name(event.type)

            if event.type==MOUSEBUTTONDOWN:

                print event.pos

               

My display is set up simply like this: windowSurface = pygame.display.set_mode((0, 0), pygame.RESIZABLE, 32)  ... and I’m working in Windows for this project. I’ve already tried updating my drivers and my version of directX, and have calibrated the touchscreen using the software provided with the laptop – it works fine for other programs.

 

I’m not an expert programmer so would be grateful for any advice – is there something I have missed about setting the display, or about using two input devices?  I’m really stuck!

 

Any advice gratefully received – many thanks,

Caroline





--
www.fladd.de - fladd.de: Homepage of Florian Krause
blog.fladd.de - fladd's Blog: Blog of Florian Krause
intermezzo.fladd.de - Intermezzo: Music by Florian Krause and Giacomo Novembre