Look at using the Canvas to draw a line or multiple lines. It might be simplest create a widget that draws a line segment. The canvas can draw anywhere in the window.
Here is a short example that creates a LineWidget.
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import ColorProperty, ListProperty, NumericProperty
from kivy.uix.widget import Widget
kv = """
<LineWidget>:
canvas:
Color:
rgba: self.line_color
Line:
width: self.line_width
points: (*self.p1, *self.p2)
BoxLayout:
LineWidget:
p1: 0, 20
p2: 400, 400
LineWidget:
p1: 400, 0
p2: 0, 600
line_color: 'red'
"""
class LineWidget(Widget):
p1 = ListProperty([0,0])
p2 = ListProperty([0,0])
line_color = ColorProperty('white')
line_width = NumericProperty(2)
class DrawLinesApp(App):
def build(self):
return Builder.load_string(kv)
DrawLinesApp().run()
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/72de101d-6249-494e-947c-b05168aac113n%40googlegroups.com.