Kivy:删除右键单击时创建的红点

Kivy: Remove the red dot creation on right clic

使用 Pyinstaller 在 Windows 上创建 kivy exe 时,我仍然需要右键单击创建红点。

Why does right-clicking create an orange dot in the center of the circle? 建议使用它来删除此行为。

from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')

但是当我这样做时,如果我一直按住某个小部件,我将无法再在页面上滚动。 难道没有更精确的 deactivate_red_dot 而不是 deactivated_multitouch 似乎有副作用吗?也许我们可以覆盖 Mouse() 的方法?

venv/Lib/site_packages/kivy/input/providers/mouse.py

方法on_mouse_press

替换

do_graphics = (not self.disable_multitouch) and (
                button != 'left' or 'ctrl' in modifiers)

来自 do_graphics = False

我不确定我是否不会有其他副作用,但从我在代码中看到的行为来看,这似乎是合法的。

编辑: 实际上对于我的项目,禁用多点触控的错误在 android 所以我做了:

if isWindows():
    from kivy.config import Config
    Config.set('input', 'mouse', 'mouse,disable_multitouch')

好的一面,不改变基本库。不好的一面,禁用多点触控可能会导致其他偷偷摸摸的错误。