I am having trouble understanding how buttons launch actions such as, for example, loading a new (2nd) canvas.
Suppose I have an application, a game, that will respond at some point to user imput via buttons: I have two buttons named "Yes" and "No"; now if the user selects "No" nothing happens and the game is in the same state it was before the buttons appeared for user input. But, if the user chooses "Yes" a function should be launched, say a Python RNG; this button will force the program to drop into the area of code holding the RNG, the RNG will run and return a value. I have the RNG and it works well, but I am not sure how I will code the buttons to call upon the RNG.
I am new to using GUI interfaces and it seems a bit abstract and disconnected at this point. I am learning much by researching this (and all related questions) but I need help with the theory of button use, how it is used to fire code, and and how it is best to code it. I just need to know where to look and I need to understand what I find.
Thank-you in advance,