Input shifted in pygame and adafruit-touchscreen

2019-09-17 14:43发布

I am facing an issue with the input into pygame using the following hardware:

the Touchscreen is set up according to the howto on the adafruit website (fixing resolution in /boot/config.txt to 800x480px).

It is all working perfect in the userinterface in raspbian. But as soon as i start my pygame application, I experience strange behaviour. The application is working perfectly well on a normal pc. It seems like the video resolution is correct, but one of the touchscreen is slightly higher.

I am calling pygame with:

self._display_surf = pygame.display.set_mode([800,480], pygame.FULLSCREEN)
self._display_surf.fill(COLOR_BG)
pygame.display.update()

The issue I am facing is that if I slide over the screen, the mouse pointer is "overtaking" me. I made a little video for better understanding.

I already printed a list with

pygame.display.list_modes(16)

where I end with

[(1600, 1200), (1280, 1024), (1024, 1024), (1280, 960), (1152, 864), (1024, 768), (800, 600), (768, 576), (800, 480), (640, 480)] 

But I have no idea where these come from. I cannot set different resolutions for touch input and screen, am I right?

1条回答
乱世女痞
2楼-- · 2019-09-17 15:25

The issue was produced by calling the program via ssh. Calling the program in a local shell solved the problem.

查看更多
登录 后发表回答