I'm a relatively new Python programmer, but I have all the basics down. Currently I'm working on a program that sends and receives serial input and receives video input. I have gotten this to work in a basic command prompt structured code however I want to be able to implement a Tkinter GUI to lessen the complication of using a command prompt. However the big problem I am having is updating things after I have created the GUI. for example I have Label widget that displays an image from the webcam, but the image is constantly being updated so it only shows the very first image. Also I have to be able to repeatedly send and receive serial information and change certain variables after obtaining that information; these variables affect many of the widgets, what they display, and what they do. I have tried doing an infinite loop so that I can get input but when I do the GUI disappears. Do I have to remake the widgets each time something is updated? Is there a different way to go about implementing a GUI? I have also heard that threading may be able to solve my problem. If anyone could steer me in the right direction that would be fantastic. Also please forgive me if I was overly vague.
Jump to Post
Well if your running your tkinter gui by calling: root.mainloop() or something similiar then you should change that to:
while 1: root.update() #repeat code here
You do everything as normal but then when you get to the displaying part, you enter a loop which updates the gui …
All 3 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.