在树莓派上以root用户身份通过​​触摸屏运行Kivy应用 [英] Run Kivy app as root user with touch screen on raspberry pi

查看:210
本文介绍了在树莓派上以root用户身份通过​​触摸屏运行Kivy应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为树莓派制作一个可以使用触摸屏的奇异应用程序.我仅使用"python〜/kivy/examples/demo/showcase/main.py"就可以将演示与触摸屏配合使用.问题出在我需要使用"sudo python main.py"启动应用程序时,触摸屏随后停止工作.

I want to make a kivy app for the raspberry pi that can use a touch screen. I was able to get the demos to work with the touchscreen with just "python ~/kivy/examples/demo/showcase/main.py". The issue comes when I need to start the app with "sudo python main.py", the touchscreen then ceases to work.

我要编写的应用程序使用rpi_ws281x库来控制可作为根运行的可寻址led.有没有办法在仍然启用触摸屏功能的同时以root用户身份运行kivy应用程序?

The app I am trying to write uses the rpi_ws281x library for controlling addressable leds which HAS to be run as root. Is there a way to run the kivy app as root while still enabling the touchscreen functionality?

如果没有,是否有办法从kivy应用程序发送数据,说一个正在运行sudo的脚本来控制LED?

If there isn't, is there a way to send data from the kivy app to say a script which is running sudo that controls the leds?

我看过很多地方,但是以前似乎没有人遇到过这个问题(或者他们可以通过更改其他访问sudo受保护内容的目录的特权来解决此问题).任何帮助是极大的赞赏!

I've looked a lot of places but no one seems to have had this problem before (or they could work around it by changing the privileges of other directories where they were accessing the sudo protected content). Any help is greatly appreciated!

推荐答案

显然,我看起来不够努力.解决方案是将〜/.kivy/config.ini"复制到"/root/.kivy/config.ini"

Well apparently I didn't look hard enough. The solution is to copy "~/.kivy/config.ini" to "/root/.kivy/config.ini"

所以命令是

"sudo cp〜/.kivy/config.ini/root/.kivy/config.ini"

"sudo cp ~/.kivy/config.ini /root/.kivy/config.ini"

然后一切都一起快乐地工作!

And then everything works happily together!

这篇关于在树莓派上以root用户身份通过​​触摸屏运行Kivy应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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