0

Basically I want to create type of quiz in Python 3.4 with EasyGui using multiple images on the button boxes. How I'd imagine it'd work would be like this:

import easygui as eg

# A welcome message
eg.msgbox ("Welcome to the quiz", "Quiz!")
# A short splash screen this could be looped
Finish = "Start"
while Finish  == "Start":

    Finish = eg.buttonbox("Do you want to start the quiz or quit?","Welcome",["Start","Quit"])
    if Finish == "Quit":
        break
    #Question 1
    image = "mickey.gif"
    choices = ["Mickey","Minnie","Daffy Duck","Dave"]
    reply=eg.buttonbox("Who is this?",image = image,choices = choices)

    if reply == "Mickey":
        eg.msgbox("Well done!","Correct")
    else:
        eg.msgbox("Wrong","Failure")

This works, but if I change the line

reply=eg.buttonbox("Who is this?",image=[image,image2,image3,image4],choices = choices)    

But that doesn't seem to work, does anyone know if you can have more than one image per buttonbox?

2 Answers2

1

at the current version of easygui, you can't have multiple images, only one image.

You could either:

  • use an external tool to create one big merged image out of several smaller images.
  • try to make the necessary changes direct inside easygui.py (it's all in one single file) if you have knowledge in tkinter
  • help / contact Robert Lugg as he works on an improved version of easygui https://github.com/robertlugg/easygui
Horst JENS
  • 116
  • 2
  • 3
1
allpic = ("image", "image2", "image3")

reply=eg.buttonbox("Who is this?",image=allpic,choices = choices) 
lczapski
  • 4,026
  • 3
  • 16
  • 32
  • 2
    While this code snippet may be the solution, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. – CEH Nov 25 '19 at 19:10