Making a Quiz with EasyGui
Your challenge today is to make a quiz for other members of your class. You'll use EasyGui's button and message boxes, together with your knowledge of python's variables to keep score. Can you create a quiz so devious and crafty that your classmates will declare it impossible?
Quick EasyGui Reference:
msgbox
result = easygui.msgbox("yourtext") - pops up a message box with an OK button.
the value 'OK' will be placed in the variable result when the OK button is pressed.
the value 'OK' will be placed in the variable result when the OK button is pressed.
answer = easygui.msgbox("Are you ready for The Impossible Quiz?")
enterbox
result = easygui.enterbox("yourtext")
Allows the user to enter some text and puts that text into the result variable
Allows the user to enter some text and puts that text into the result variable
answer = easygui.enterbox("What is your name?")
buttonbox
result = easygui.buttonbox("yourtext",choices=("Choice One", "Choice Two", "Choice Three")
The value placed in the result variable will be the text of the chosen button.
The value placed in the result variable will be the text of the chosen button.
answer = easygui.buttonbox("Which is the best team?",choices=("Tottenham","Watford"))
Adding a picture
You can add a picture to a button box. It MUST be in .gif format and it MUST be in the same folder as your program.
Search on google images for what you want, but add ".gif" to the search term to find .gif images.
Search on google images for what you want, but add ".gif" to the search term to find .gif images.
answer = easygui.buttonbox("Which is the best team?",image="troll.gif",choices=("Tottenham","Watford"))