The next step is to start the actual debugging process. Putting print
calls in the code as you’ve done can give useful information, but information is only useful when seen by someone who’s actively trying to understand it.
So.
What results are you getting from the print
s? For example, do you ever see anything interesting from print(event, values)
? (Do you see anything printed at all, to confirm that the code gets to this point?) How about the other print
s? Are the elif
cases entered in the situations where you expect?
My guess is that the values you compare event
with are wrong, and that the code also needs to care about the values
. I don’t know how to use that GUI library, but it looks very suspicious to me to compare event
to some sg.Radio
result, because it looks like calling sg.Radio
is how you made the radio button in the first place. An event is not going to be equal to a widget, and constantly making new widgets is probably not good.
I guess you mean VS Code (Visual Studio Code).
One possible reason for getting this distortion is mixing spaces and tabs. It’s possible to make that work with extreme care, but it’s still a bad idea. Also, if you’re trying to format the code for posting by adding extra indentation, please don’t. Markdown may support that, but it’s much easier and more reliable to use code fences, as described in the pinned thread.