1
如何更改我製作的kivy Paint應用程序中的線條顏色。我可以改變線條的寬度,但是我找不到改變線條顏色的任何東西。KIVY:更改Paint App中的線條顏色
我的代碼:
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()
非常感謝!我錯過了導入Color。那讓生活變得很悲慘。 – thechargedneutron
@thechargedneutron你很好:) – EL3PHANTEN