3. Basic Window

3.1. Window with Brython

  • You may have noticed that in the basic window the buttons did nothing.

  • It is necessary to link an event to each button.

  • This is called event-driven programming.

  • We need to wait for user actions.

3.2. Capturing an Event

  • To capture an event from a button, it is necessary to create a function.

  • In the function, all the logic that is wanted for the button will be found.

  • We will create a new window with a button and we will capture or link an event.

  • We will show a message on the screen every time the user presses the button.

  • Perfect, now you know how to capture events.

  • You can capture events using the .bind() function specifying the event or using a @bind instruction, also called decorator.
    • This instruction is written on a line previous to the button handling function.

  • Knowing this logic we can finish the Zombie Question Show.

  • Remember the reproduction of sounds and the logic of the different options.

You have attempted of activities on this page