gpt4 book ai didi

Kivy 在我的应用程序中没有检测到触摸输入

转载 作者:行者123 更新时间:2023-12-02 08:25:30 32 4
gpt4 key购买 nike

我在 Raspberry Pi 上使用 Kivy,利用新的官方 7"触摸屏。我正在尝试制作一个应用程序,利用触摸屏进行简单的按钮/ Accordion 操作,但输入没有到达 kivy 程序。我错过了吗下面的代码有什么重要的东西吗?

触摸屏在 X 中工作正常,我还可以在进行多点触控手势时 cat/dev/input/event0 并查看缓冲区中的数据。

根据 Kivy 本身,我在启动应用程序时肯定会初始化触摸屏:

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_15-09-16_22.txt
[INFO ] [Kivy ] v1.9.1-dev
[INFO ] [Python ] v2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3]
[INFO ] [Factory ] 177 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_pygame (img_pil, img_ffpyplayer ignored)
[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 ] [Text ] Provider: pygame
[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 <FT5406 memory based driver>
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range ABS X position is 0 - 800
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range ABS Y position is 0 - 480
[INFO ] [GL ] NPOT texture support is available
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range position X is 0 - 800
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range position Y is 0 - 480

我的源代码非常初级:

import kivy
kivy.require('1.0.7')

from kivy.app import App

def button_pressed():
exit(0)


class CarInterfaceApp(App):
pass

if __name__ == '__main__':
CarInterfaceApp().run()

我的 kv 文件同样非常简单:

#:kivy 1.0

Accordion:
min_space: 60
orientation: 'vertical'
AccordionItem:
title: 'Car'
AccordionItem:
title: 'Music'
AccordionItem:
title: 'Messaging'

最佳答案

为了在 Arch Linux Arm 上运行,我有 2 个问题需要解决。

第一个问题是 Peter 的回答所涵盖的问题 - 我的配置中没有 mtdev。我将 ~/.kivy/config.ini[input] 部分设置为

[input]
mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput

第二个问题是 stderr 有

[INFO              ] [ProbeSysfs  ] unable to found provider mtdev
[INFO ] [ProbeSysfs ] fallback on hidinput

这里的解决方案是使用 pacman -S mtdev 安装 mtdev

关于Kivy 在我的应用程序中没有检测到触摸输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32616431/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com