Dear Friends
I want to draw x, y coordinates of line with the data from serial port. However, the coordinates are available but there is no update on the GUI (graphics). How to update it similar to <root.update()> tkinter?
Thanks
File: sample.kv
***************************************************************************
<MyScreenManager>:
Home:
name: 'Home'
<Home>:
name: 'Home'
BoxLayout:
orientation: 'vertical'
BoxLayout:
size_hint_y: 50
orientation: 'horizontal'
Button:
id: road
text: 'Plot'
font_size: 25
background_color: 0,0,1,1
on_release: app.root.plot()
BoxLayout:
size_hint_y: 1000
orientation: 'horizontal'
BoxLayout:
size_hint: 0.9, 1
orientation: 'horizontal'
Widget:
id: my_can5
x0: self.width*.02
y0: self.height/3
my_clr: 0,1,0,1
mi_pts: 875, 0, 200, 0
canvas:
Color:
rgba: self.my_clr
Line:
points: self.mi_pts
width: 3
***************************************************************************
***************************************************************************
File: sample.py
***************************************************************************
class MyScreenManager(ScreenManager):
def plot(self):
print "In"
i = 1
x0 = 875
y0 = 900
x1 = 550
y1 = 925
inVoltS = serial.Serial('/dev/tty.usbmodem1411', 9600)
while i > 0:
inVoltR = float(inVoltS.readline()) # Read the newest output from the Arduino
inVolt = inVoltR * 100
print "Yes", inVolt
x1 = x1 + 1
y1 = y1 + inVolt
newPoint = self.get_screen('Home').ids.my_can5.mi_pts = (x0,y0,x1,y1)
print newPoint
x0 = x1
y0 = y1
sleep(1)
i = i + 1
#***************** APP OBJECT ***********************
class zAmpleApp(App):
def build(self):
return MyScreenManager()
if __name__ == '__main__':
zAmpleApp().run()