适用于 Raspberry Pi 的触摸屏 Kivy 应用程序 [英] Touchscreen Kivy app for Raspberry Pi

查看:20
本文介绍了适用于 Raspberry Pi 的触摸屏 Kivy 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是场景:我使用 python 框架 Kivy 编写了一个 gui,我想在一个带有这个触摸屏的树莓派.我已经很好地完成了安装,并且 TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen FRAMEBUFFER=/dev/fb1 nohup startx & 让 xwindow 桌面 gui 运行良好.不过,我一直无法让我的 kivy gui 工作.我能够让测试 tkinter 应用程序正常工作,通过设置 DISPLAY 环境变量.

Here's the scenario: I've written a gui using the python framework Kivy, and I want to run it on a raspberry pi with this touchscreen. I've done the installation fine, and TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen FRAMEBUFFER=/dev/fb1 nohup startx & gets the xwindow desktop gui running fine. I've been unable to get my kivy gui working, though. I was able to get a test tkinter application working ok, by setting the DISPLAY environment variable.

我尝试将以下内容放在我的 kivy 应用程序的顶部,但无济于事:

I tried putting the following at the top of my kivy app, but to no avail:

os.environ['SDL_VIDEODRIVER'] = 'fbcon'
os.environ['SDL_FBDEV'] = '/dev/fb1'
os.environ['SDL_MOUSEDRV'] = 'TSLIB'
os.environ['SDL_MOUSEDEV'] = '/dev/input/touchscreen'

当我运行我的应用程序时,这是调试输出:

When I run my application, this is the debug output:

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_14-04-21_10.txt
[INFO   ] Kivy v1.8.1-dev
[INFO   ] [Python      ] v2.7.3 (default, Mar 18 2014, 05:13:23) 
[GCC 4.6.3]
[INFO   ] [Factory     ] 157 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pygame, img_gif (img_pil ignored)
[INFO   ] [Text        ] Provider: pygame
[INFO   ] [Loader      ] using a thread pool of 2 workers
[INFO   ] [Window      ] Provider: egl_rpi
[INFO   ] [GL          ] OpenGL version <OpenGL ES 2.0>
[INFO   ] [GL          ] OpenGL vendor <Broadcom>
[INFO   ] [GL          ] OpenGL renderer <VideoCore IV HW>
[INFO   ] [GL          ] OpenGL parsed version: 2, 0
[INFO   ] [GL          ] Shading version <OpenGL ES GLSL ES 1.00>
[INFO   ] [GL          ] Texture max size <2048>
[INFO   ] [GL          ] Texture max units <8>
[INFO   ] [Shader      ] fragment shader: <Compiled>
[INFO   ] [Shader      ] vertex shader: <Compiled>
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event0
[INFO   ] [HIDInput    ] Read event from </dev/input/event0>
[INFO   ] [Base        ] Start application main loop
[INFO   ] [HIDMotionEvent] using <stmpe-ts>

我对帧缓冲区等知之甚少;我希望有人能指出我正确的方向.看来我提到的上述环境变量对于让 pygame 应用程序出现很有用,而 kivy 是基于 pygame 构建的.

I don't know much (anything) about framebuffers and such; I'm hoping someone can point me in the right direction. It appears that the above environment variables I mentioned are useful for getting pygame applications to show up, and kivy is built on pygame.

一些链接:

  • 这个是我现在正在尝试的,以防显示和需要设置一个 FBDEV.我还将检查是否实际安装了 directfb 或 fbcon.
  • 相关的 kivy google 群组问题
  • 一个叉子 我可以试试
  • This is something I'm trying right now, in case both DISPLAY and a FBDEV need to be set. I'm also going to check and see if I have directfb or fbcon actually installed.
  • The relevant kivy google group issue
  • A fork I may try

比去年 4 月晚得多,我很难直接找到任何相关信息.

I've had a hard time finding anything directly on this much later than April of last year.

任何帮助将不胜感激.提前致谢!

Any help would be greatly appreciated. Thanks in advance!

推荐答案

这行不通.SPI 屏幕在由 CPU 控制的 SPI 上工作:http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

This will not works. SPI screen works on SPI which is controlled by your CPU: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

Kivy 使用 Raspberry Pi 的 GPU,而不是 SPI 或 X11.据我了解,在 SPI 上显示加速的 GLES 应用程序是行不通的.

Kivy use the GPU of the Raspberry Pi, not the SPI or X11. As my understanding, displaying an accelerated GLES application on SPI will not work.

也就是说,您可以通过从 X11 外部的命令行执行任何 GLES 软件来确认此行为

这篇关于适用于 Raspberry Pi 的触摸屏 Kivy 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆