2024-06-06 21:05:08 发布
网友
我想开发一个绘画应用程序,创建椭圆或圆形作为鼠标在画布上移动
关于如何在kivy的网站上制作绘图应用程序,有很多很好的例子。 看看Drawing app in kivy
网站上的一个例子。你知道吗
from kivy.app import App from kivy.uix.widget import Widget from kivy.graphics import Color, Ellipse, Line 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)) touch.ud['line'] = Line(points=(touch.x, touch.y)) def on_touch_move(self, touch): touch.ud['line'].points += [touch.x, touch.y] class MyPaintApp(App): def build(self): return MyPaintWidget() if __name__ == '__main__': MyPaintApp().run()
关于如何在kivy的网站上制作绘图应用程序,有很多很好的例子。
看看Drawing app in kivy
网站上的一个例子。你知道吗
相关问题 更多 >
编程相关推荐