输入在 pygame 和 adafruit-touchscreen 中转移 [英] Input shifted in pygame and adafruit-touchscreen
问题描述
我在使用以下硬件输入 pygame 时遇到问题:
- 树莓派 1 B
- Adafruit 5" 触摸屏通过 HDMI 连接并通过 USB 触摸输入
触摸屏根据 adafruit 网站(将/boot/config.txt 中的分辨率修正为 800x480px).
在 raspbian 的用户界面中一切正常.但是一旦我启动我的 pygame 应用程序,我就会遇到奇怪的行为.该应用程序在普通 PC 上运行良好.视频分辨率似乎正确,但其中一个触摸屏略高.
我通过以下方式调用 pygame:
self._display_surf = pygame.display.set_mode([800,480], pygame.FULLSCREEN)self._display_surf.fill(COLOR_BG)pygame.display.update()
我面临的问题是,如果我滑过屏幕,鼠标指针会超过"我.我制作了一个小视频以便更好地理解.>
我已经用
打印了一个列表pygame.display.list_modes(16)
我以
结尾[(1600, 1200), (1280, 1024), (1024, 1024), (1280, 960), (1152, 864), (1024, 768), (800, 600), (768, 576), (800, 480), (640, 480)]
但我不知道这些来自哪里.我无法为触摸输入和屏幕设置不同的分辨率,对吗?
该问题是通过 ssh 调用程序产生的.在本地shell中调用程序解决了这个问题.
I am facing an issue with the input into pygame using the following hardware:
- Raspberry Pi 1 B
- Adafruit 5" Touchscreen connected via HDMI and Touch Input via USB
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?
The issue was produced by calling the program via ssh. Calling the program in a local shell solved the problem.
这篇关于输入在 pygame 和 adafruit-touchscreen 中转移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!