我想通过左键单击来使用on_touch_down,但它只是使用work右键单击和触摸移动时不能使用任何东西
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()我如何解决这个问题?
发布于 2021-04-17 01:54:51
您看不到on_touch_down()或on_touch_move()的结果。您的PaintApp的bulid()可能应该是build()。检查你的拼写。
https://stackoverflow.com/questions/67128765
复制相似问题