35

为什么kivy 中的第一个小部件示例在您右键单击画布时会导致黄色圆圈中间出现橙色圆圈,而当您左键单击时会导致纯黄色圆圈?

from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color, Ellipse

class MyPaintWidget(Widget):
    def on_touch_down(self, touch):
        with self.canvas:
            Color(1, 1, 0)
            d = 30.
            Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))


class MyPaintApp(App):
    def build(self):
        return MyPaintWidget()


if __name__ == '__main__':
    MyPaintApp().run()
4

2 回答 2

35

To disable multi-touch emulation, add this to your source file containing your main function, before any other kivy modules are imported:

from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
于 2016-06-01T15:29:08.073 回答
14

它是多点触控仿真,您可以在此处查看如何禁用它

http://kivy.org/docs/api-kivy.input.providers.mouse.html

于 2012-10-02T23:02:27.847 回答