Saturday, August 21, 2021

python 37 line 1



#widget1.kv
Widget1:
    canvas:
        Line:
            points: (0, self.height/2, self.width, self.height/2)
        Line:
            points: (self.width/2, 0, self.width/2, self.height)

        Color:
            rgba: 0, 0, 1, 1
        Line:
            rectangle: (self.width/4, self.height/4, self.width/2, self.height/2) #x, y, w, h
            width: 2

        Color:
            rgba: 1, 1, 0, 1
        Line:
            ellipse: (self.width/4, self.height/4, self.width/2, self.height/2)
            width: 2

        Color:
            rgba: 1, 0, 0, 1
        Line:
            circle: (self.width/2, self.height/2, self.height/4) if self.width > self.height else (self.width/2, self.height/2, self.width/4) #centerX, centerY, radius
            width: 2

------------------------
widget1.py
from kivy.app import App
from kivy.uix.widget import Widget


class Widget1(Widget):
    pass

class Widget1App(App):
    pass


Widget1App().run()

reference:

No comments:

Post a Comment