I am trying to get a Python GUI window using Tkinter to continuously display data streaming from an Arduino Uno board acting as a voltmeter. With the code I've got, the window will display one data point, and once the window gets closed, a new window opens up with the next available data point. Here's the code I've been using:
import serial
from Tkinter import *
ser = serial.Serial('/dev/tty.usbmodem621')
ser.baudrate = 9600
while 1 == 1:
reading = ser.readline()
root = Tk()
w = Label(root, text = reading)
w.pack()
root.mainloop()
I'm using a MacBook Pro, and the pySerial package for my serial communications. How do I get the window to refresh itself?