System Message: SEVERE/4 (/home/runner/work/PyZombis/PyZombis/_sources/lectures/TWP50/TWP50_1_en.rst, line 1)

Problems with “raw” directive path: InputError: [Errno 2] No such file or directory: ‘_sources/lectures/_static/APIWrapper.js’.

.. raw:: html
    :file: ../_static/APIWrapper.js

System Message: SEVERE/4 (/home/runner/work/PyZombis/PyZombis/_sources/lectures/TWP50/TWP50_1_en.rst, line 4)

Problems with “raw” directive path: InputError: [Errno 2] No such file or directory: ‘_sources/lectures/_static/SCORMFunctions.js’.

.. raw:: html
    :file: ../_static/SCORMFunctions.js

1. |Introduction to a Graphical User Interface

System Message: WARNING/2 (/home/runner/work/PyZombis/PyZombis/_sources/lectures/TWP50/TWP50_1_en.rst, line 7); backlink

Inline substitution_reference start-string without end-string.

1.1. Zombie Quiz Show

  • It is a game with different options.

  • Option 1 is for the correct answer and Option 2 is for the incorrect answer.

  • The program will have a sound effect for each answer.

  • The program must keep track of how many correct and incorrect answers there were.

  • Finally, press 0 to finish.

1.2. Playing Audio

  • Let’s start by creating the logic for playing audio.

  • There are various ways to do this; one option might be to use the pygame library, among others.

  • Again, we will use the Brython module.

  • The code below generates an HTML element called audio.

  • On this page, you can obtain free sounds that you can use in the program.
    • You just need to copy and paste the url of the sound you like.

  • You noticed that the audio element with controls to play and stop it was created.

  • You can add as many sounds as you want.

  • But how do I handle when the sound is played and stopped through the program?
    • Let’s link events to achieve it.

  • The sounds are playing very well.

  • Now that audio is working, let’s create the Zombie Quiz Show!

You have attempted of activities on this page