KIVY:在油漆应用程序中更改线条颜色

2024-06-26 17:03:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我如何改变线的颜色在kivy油漆应用程序,我已经做。我可以改变线条的宽度,但我找不到任何可以改变线条颜色的东西。在

我的代码:

from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Line
class DrawRandom(Widget):
    def on_touch_down(self, touch):
        with self.canvas:
            touch.ud["line"]=Line(points=(touch.x,touch.y),width=5)
    def on_touch_move(self, touch):
        touch.ud["line"].points += (touch.x, touch.y)

class PaintApp(App):
    def build(self):
        return DrawRandom()


if __name__ == "__main__":
    PaintApp().run()

Tags: fromimportselfapp颜色ondefline