简体   繁体   English

kivy 应用程序光标在窗口上方不显示

[英]kivy application cursor don't show when over the window

While I was testing an uix example of Kivy (modalview.py), the cursor suddenly disappeared while over the application window.当我测试 Kivy 的 uix 示例(modalview.py)时,光标在应用程序窗口上方突然消失。 When I move out of the window, the cursor reappears.当我移出窗口时,光标重新出现。 The cursor disappears only when it is inside the Kivy window, but I can still interact with the widgets (ie buttons, ...).光标只有在 Kivy 窗口内时才会消失,但我仍然可以与小部件(即按钮,...)进行交互。 Since then, I have this behaviour with any Kivy application and only these applications.从那以后,我对任何 Kivy 应用程序都有这种行为,而且只有这些应用程序。

I have reinstalled Python and Kivy, I have restarted my computer, updated my touchpad and GPU drivers (even though there should be absolutely no reason, but I'm desperate...), nothing changes.我已经重新安装了 Python 和 Kivy,我已经重新启动了我的计算机,更新了我的触摸板和 GPU 驱动程序(即使绝对没有理由,但我很绝望......),没有任何变化。

Any suggestion?有什么建议吗? Thanks!谢谢!

I'm working with: Windows 10 Python 3.7.2 Kivy 1.10.1我正在使用:Windows 10 Python 3.7.2 Kivy 1.10.1

The solution (thanks to inclement) is to simply check the Kivy settings.解决方案(感谢 inclement)是简单地检查 Kivy 设置。

The best way to access them (to me) is launching the "Settings.py" in "Lib\\site-packages\\kivy\\uix\u0026quot;.访问它们的最佳方式(对我而言)是在“Lib\\site-packages\\kivy\\uix”中启动“Settings.py”。

From there, the "show/hide cursor" can be toggled on.从那里,可以打开“显示/隐藏光标”。

Even I had the exact same issue.即使我有完全相同的问题。 The reason was that I ran a code and changed a setting unknowingly.原因是我运行了一个代码并在不知不觉中更改了设置。 I fixed the issue by running the program again and changed the settings.我通过再次运行程序并更改设置来解决该问题。 If you have this issue, you would find "Mouse Cursor" off.如果您遇到此问题,您会发现“鼠标光标”已关闭。 On the mouse cursor and the problem is fixed.在鼠标光标上,问题已解决。 What this does is, it directly changes the kivy settings.这样做的是,它直接更改了 kivy 设置。 Thus, the change is permanent.因此,这种变化是永久性的。

from kivy.app import App
from kivy.lang import Builder

from kivy.uix.boxlayout import BoxLayout

Builder.load_string('''
<Interface>:
    orientation: 'vertical'
    Button:
        text: 'Settings'
        font_size: 100
        on_release: app.open_settings()
''')


class Interface(BoxLayout):
    pass


class SettingsApp(App):
    def build(self):
        return Interface()


SettingsApp().run()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM