So I am creating a Python Tkinter application, which has a measured value I need displayed to the screen every second. When the program runs, the value show, but it isn't updating (I am externally manipulating the value so I know the display should be changing). How do I get the display to dynamically update every second? I was made to understand that I didn't need to create an Update() method or anything for Tkinter applications because mainloop() takes care of that. Here is my code:
Main.py:
from SimpleInterface import SimpleInterface from ADC import Converter, Differential adc = Converter(channelNums = [2]) root = SimpleInterface(adc) root.title = ("Test Interface") root.mainloop() SimpleInterface.py:
import tkinter as tk from tkinter import ttk class SimpleInterface(tk.Tk): def __init__(self, ADC, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) container = tk.Frame(self, *args, **kwargs) container.grid(column = 0, row = 0, sticky = "nwes") container.grid_rowconfigure(0, weight = 1) container.grid_columnconfigure(0, weight = 1) frame = Screen(ADC, container, self) frame.grid(row = 0, column = 0, sticky = "nsew") frame.tkraise() class Screen(tk.Frame): def __init__(self, ADC, parent, controller): tk.Frame.__init__(self, parent) displayText = ADC.ReadValues() #this method returns a list of values for i in range(len(displayText)): displayText[i] = round(displayText[i], 2) ttk.Label(self, text = "Test Display", background = "grey").grid(column = 7, row = 8) lblTestDisplay = ttk.Label(self, text = displayText, foreground = "lime", background = "black").grid(column = 7, row = 9, sticky = "ew") So the display properly shows the displayText when the code is initially run, but again nothing changes as I manually manipulate the value being input. Do I need to create an Update() method? If so where would I call said method?