I have simple code to visualize some data using tkinter. A button click is bound to a function that redraws the next “frame” of data. However, I would like to be able to automatically redraw at a certain frequency. I am very green when it comes to GUI programming (I don’t need to do much for this code), so most of my tkinter knowledge comes from the following and modifying examples. I think I can use root.after to achieve this, but I'm not quite sure that I understand how from other codes. The basic structure of my program is as follows:
def Visualisation:
def __init__(self, args):
def update_canvas(self, Event):
canvas.delete(ALL)
canvas.create_........
vis = Visualisation(s, canvasWidth, canvasHeight)
root = Tk()
canvas = Canvas(root, width = canvasWidth, height = canvasHeight)
canvas.grid(column=0, row=0, sticky=(N, W, E, S))
canvas.bind('<Button-1>', vis.update_canvas)
root.mainloop()
Apologies for asking the question, which I am sure has an obvious and simple answer. Many thanks.