如何在kivy启动时使用触摸屏?
How to use touchscreen on startup with kivy?
目前我正在为我的 pi 3 在 kivy 中构建一个应用程序。它应该支持触摸屏,因为我想使用我新买的 eGalax Inc. USB TouchController。当我尝试从命令 运行 时,应用程序启动并运行。
但是我希望从引导启动它,而不需要用户交互来启动它。就像来自 rc.local 脚本。我已经尝试了一些不同的方法,但尽管应用程序启动了,但触摸屏不会响应我的输入。我将提供我的 .kivy/config.ini
文件:
[kivy]
keyboard_repeat_delay = 300
keyboard_repeat_rate = 30
log_dir = logs
log_enable = 1
log_level = info
log_name = kivy_%y-%m-%d_%_.txt
window_icon =
keyboard_mode =
keyboard_layout = qwerty
desktop = 1
exit_on_escape = 1
pause_on_minimize = 0
kivy_clock = default
default_font = ['Roboto', 'data/fonts/Roboto-Regular.ttf', 'data/fonts/Roboto-Italic.ttf', 'data/fonts/Roboto-Bold.ttf', 'data/fonts/Roboto-BoldItalic.ttf']
log_maxfiles = 100
window_shape = data/images/defaultshape.png
config_version = 20
[graphics]
display = -1
fullscreen = 'auto'
height = 600
left = 0
maxfps = 60
multisamples = 2
position = auto
rotation = 0
show_cursor = 1
top = 0
width = 800
resizable = 0
borderless = 0
window_state = visible
minimum_width = 0
minimum_height = 0
min_state_time = .035
allow_screensaver = 1
shaped = 0
[input]
mouse = mouse
#%(name)s = probesysfs,provider=hidinput
egalax = hidinput,/dev/input/event0,rotation=90,invert_y=1
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput
[postproc]
double_tap_distance = 20
double_tap_time = 250
ignore = []
jitter_distance = 0
jitter_ignore_devices = mouse,mactouch,
retain_distance = 50
retain_time = 0
triple_tap_distance = 20
triple_tap_time = 375
[widgets]
scroll_timeout = 250
scroll_distance = 20
scroll_friction = 1.
scroll_stoptime = 300
scroll_moves = 5
[modules]
cursor = 1
所以如果有人成功了,你做了什么?
经过一段时间的搜索,我在这个特定的站点中找到了一个解决方案。
如果您已经将.kivy/config.ini 文件设置为在您使用命令启动kivy 时可以正常工作,那么这将对您有效:
"sudo cp ~/.kivy/config.ini /root/.kivy/config.ini"
它将配置文件复制到根文件夹,这让我可以在启动时使用触摸屏。
source
目前我正在为我的 pi 3 在 kivy 中构建一个应用程序。它应该支持触摸屏,因为我想使用我新买的 eGalax Inc. USB TouchController。当我尝试从命令 运行 时,应用程序启动并运行。
但是我希望从引导启动它,而不需要用户交互来启动它。就像来自 rc.local 脚本。我已经尝试了一些不同的方法,但尽管应用程序启动了,但触摸屏不会响应我的输入。我将提供我的 .kivy/config.ini
文件:
[kivy]
keyboard_repeat_delay = 300
keyboard_repeat_rate = 30
log_dir = logs
log_enable = 1
log_level = info
log_name = kivy_%y-%m-%d_%_.txt
window_icon =
keyboard_mode =
keyboard_layout = qwerty
desktop = 1
exit_on_escape = 1
pause_on_minimize = 0
kivy_clock = default
default_font = ['Roboto', 'data/fonts/Roboto-Regular.ttf', 'data/fonts/Roboto-Italic.ttf', 'data/fonts/Roboto-Bold.ttf', 'data/fonts/Roboto-BoldItalic.ttf']
log_maxfiles = 100
window_shape = data/images/defaultshape.png
config_version = 20
[graphics]
display = -1
fullscreen = 'auto'
height = 600
left = 0
maxfps = 60
multisamples = 2
position = auto
rotation = 0
show_cursor = 1
top = 0
width = 800
resizable = 0
borderless = 0
window_state = visible
minimum_width = 0
minimum_height = 0
min_state_time = .035
allow_screensaver = 1
shaped = 0
[input]
mouse = mouse
#%(name)s = probesysfs,provider=hidinput
egalax = hidinput,/dev/input/event0,rotation=90,invert_y=1
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput
[postproc]
double_tap_distance = 20
double_tap_time = 250
ignore = []
jitter_distance = 0
jitter_ignore_devices = mouse,mactouch,
retain_distance = 50
retain_time = 0
triple_tap_distance = 20
triple_tap_time = 375
[widgets]
scroll_timeout = 250
scroll_distance = 20
scroll_friction = 1.
scroll_stoptime = 300
scroll_moves = 5
[modules]
cursor = 1
所以如果有人成功了,你做了什么?
经过一段时间的搜索,我在这个特定的站点中找到了一个解决方案。
如果您已经将.kivy/config.ini 文件设置为在您使用命令启动kivy 时可以正常工作,那么这将对您有效:
"sudo cp ~/.kivy/config.ini /root/.kivy/config.ini"
它将配置文件复制到根文件夹,这让我可以在启动时使用触摸屏。
source