Sep-17-2020, 05:22 PM
GUI programming is confusing. A lot of new GUI programmers think they need to wait for buttons to be pressed or text to be entered or for time to pass between updating values in the window. They are used to the code dictating what the program does.
This is not how GUI programming done. GUI programming is event based. The user of the program dictates what the program does. You write actions that are executed in response to user events. In tkinter this is done by specifying a function that is called when a button is pressed or a StringVar (IntVar...) value is changed. Periodic updates are done using "after" to call a function after some time has passed. Nowhere in your program can you have a loop that runs forever, and all the action code should be writtin to take very little time or the GUI is unresponsive and feels buggy. It is completely backward from the kind of code you are used to writing
This is not how GUI programming done. GUI programming is event based. The user of the program dictates what the program does. You write actions that are executed in response to user events. In tkinter this is done by specifying a function that is called when a button is pressed or a StringVar (IntVar...) value is changed. Periodic updates are done using "after" to call a function after some time has passed. Nowhere in your program can you have a loop that runs forever, and all the action code should be writtin to take very little time or the GUI is unresponsive and feels buggy. It is completely backward from the kind of code you are used to writing