简体   繁体   English

关于 on_touch_down 和 on_touch_move

[英]about on_touch_down and on_touch_move

I want to work with on_touch_down with a left-click but it just with work right-click and on touch move didn't work with anything我想通过左键单击使用 on_touch_down 但它只是通过右键单击和触摸移动对任何东西都不起作用

from kivy.app import App
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.graphics import Ellipse, Color, Line

Window.clearcolor = (47/255, 72/255, 125/255, 1)


class PaintWindow(Widget):
    def on_touch_down(self, touch):
        s = 30
        self.canvas.add(Color(rgb=(184/255, 154/255, 200/255)))
        self.canvas.add(Ellipse(pos=(touch.x - s/2, touch.y - s/2), size=(s, s)))
        touch.ud["line"] = Line(points=(touch.x, touch.y))
        self.canvas.add(touch.ud)

    def on_touch_move(self, touch):
        touch.ud["line"].points += Line(points=(touch.x, touch.y))


class PaintApp(App):
    def bulid(self):
        return PaintWindow()
PaintApp().run()

how can i fix this problem我该如何解决这个问题

You are not seeing the results of your on_touch_down() or on_touch_move() .您没有看到on_touch_down()on_touch_move()的结果。 Your PaintApp has a bulid() that probably should be build() .您的PaintApp有一个可能应该是build() bulid() Check your spelling.检查你的拼写。

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

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