Title
import PySimpleGUI as sg
import random
restaurants = {
"McDonald's": "Founded in 1940 by Richard and Maurice McDonald.",
"Burger King": "Founded in 1953 by James McLamore and David Edgerton.",
"Wendy's": "Founded in 1969 by Dave Thomas.",
"Taco Bell": "Founded in 1962 by Glen Bell.",
"KFC": "Founded in 1930 by Harland Sanders."
}
def play_game():
# Get a random restaurant and its fact
restaurant, fact = random.choice(list(restaurants.items()))
layout = [
[sg.Text('Match the following fast food restaurant with its fact:')],
[sg.Text(fact)],
[sg.Input(key='guess')],
[sg.Button('Submit')]
]
window = sg.Window('Fast Food Restaurants').Layout(layout)
event, values = window.Read()
window.Close()
if values['guess'].lower() == restaurant.lower():
sg.Popup("Correct!")
else:
sg.Popup("Incorrect. The correct answer is {}".format(restaurant))
play_game()