Jan-10-2021, 05:31 PM
In a GUI there are a lot of signals telling the application what is going on and some of these signals are a bit confusing, e.g. "sg.WIN_CLOSED" which only tells you that a window has given "None" as signal, not telling which window. Thus, I note that to start with there is no help window by declaring
It might be that I am overly careful, but in my experience (50+ years of programming in a multitude of languages and in a large range of applications, the biggest counting millions of lines of code. I am 75 and still active as a programmer), if you are not careful with these matters, sooner or later there is a crash.
And, when that occurs, you want to be able to find the bug quickly. The more careful you are, the more precautions you take, the simpler to locate the error.
So far your application is small but it will grow. Being careful is a good basis for application development.
window_help=Noneand that means that
if window_help and win == window_helpensures that the part
win == window_helpis tested only if window_help has a value (is referring to a window). If not you may have a crash when trying to close the window_help window (error: 'NoneType' object has no attribute 'close'). The python construct "if A and B" calculates B only if A is True (sort of a shortcut of the whole expression).
It might be that I am overly careful, but in my experience (50+ years of programming in a multitude of languages and in a large range of applications, the biggest counting millions of lines of code. I am 75 and still active as a programmer), if you are not careful with these matters, sooner or later there is a crash.
And, when that occurs, you want to be able to find the bug quickly. The more careful you are, the more precautions you take, the simpler to locate the error.
So far your application is small but it will grow. Being careful is a good basis for application development.