简体   繁体   中英

Raspberry Pi Pygame touch screen issues

I have recently bought a Hyperpixel 4.0 from pimoroni for my raspberry pi. I have also made a Pygame interface with the aim of using the touch screen as the input device. This works perfectly when I am in the desktop interface, even when the window is full screen. However, I don't want to run it in the desktop, I want it to run in the terminal (no startx) When I do this, the mouse calibration is not correct and makes it unusable. I have tried several methods including forcing Pygame to detect the touch screen to no avail. It either works, it the mouse goes crazy. Can anyone help here? I can't find much online. Thanks!

The problem is that the Raspbian window system calibrates the Hyperpixel touch locations, but pygame directly accesses the touch device but is not calibrated.

My solution was to use a desktop application in full screen mode.

I tried doing a matrix based calibration of my own, but it appears that the behavior is nonlinear.

I had the same issue, except it turned out that calibration was never the issue. There seems to be something wrong in SDL or pygame that actively breaks this, as in my case the touch locations reported by the touchscreen were accurate.

I posted a writeup how I did my own touch handling in python here:

https://stackoverflow.com/a/71827823/571608

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM