easy gui .buttonbox помещает каждую букву слова в отдельные поля, а не в одну - PullRequest
0 голосов
/ 24 марта 2020

easy gui .buttonbox помещает каждую букву слова в отдельные поля, а не в одну, я не знаю, как это исправить, было бы очень полезно, если бы кто-то мог сказать мне, что не так с моим кодом, это выглядит так Как это выглядит

Я пытался поставить запятые, это не работает, и попытка удалить их тоже не работает.

#importing Modules Easygui and Sys to allow the use of easygui and sys
#to be able to exit
import sys
import easygui
from easygui import *

#Variable to record players score throughout the quiz will be used to
#tell player their score
score = 0

#Aks for users their name and welcomes the user and tells them the rules
#it will also ask for their age to check if they are too old or too
#young or meet the age requirment for quiz_a or quiz_b
name = easygui.enterbox("Whats your name?")

easygui.msgbox("Welcome {} to the New Zealand triva quiz \n Rules: \n 1. \
 You must be 5-11 years of age \n 2. \
 Do not cheat \n 3. Follow the rules.".format(name))

age = easygui.integerbox("Whats your age")


#list that will be used to give user atleast 3 questions from the 
#quiz_a or quiz_b and give them possible answers from quiz_a_poss or
#quiz_b_poss as well as the correct answer

quiz_a_ques = ["1.What is the capital of New Zealand?",
"2.Which city is known as The Garden City?",
"3.Where did L&P soda originally come from?",
"4.In what month is Matariki celebrated?",
"5.What colour is Kakariki?"]

quiz_a_ans = ["Wellington"," Christchurch","Paeroa","June","Green"]

quiz_a_poss = ["Auckland Wellington Christchurch Hamilton",
"Wellington Christchurch Paeroa Auckland",
"April May June July",
"Green Blue Black Grey"]

quiz_b_ques = ["1.What is the name of the strech of water \
that separates the North and South Island?",
"2.Which New Zealand city houses the beehive",
"3.Where is the 90 mile beach",
"4.When was the Treaty of Waitangi signed"]

quiz_b_ans = ["Cook Strait",
"Wellington",
"Ohakune",
"Top of the north island",
"1840"]

def quiz_a():
        global choice_a,quiz_a,quiz_a_ans

        for i in range(0,4):
                choice_a = buttonbox(quiz_a_ques[i], choices = (quiz_a_poss[i]))

        if choice_a == quiz_a_ans[i]:
                easygui.msgbox("Congradulation you got the answer correct")
                score += 1

        else:
            easygui.msgbox("Sorry, you got it wrong the right answer was {} \
             ".format(quiz_a_ans[i]))

def quiz_b():
        global choice_b, quiz_b, quiz_b_ans

        for i in range (0,4):
                choice_b = buttonbox(quiz_b_ques[i],choices = (quiz_b_poss[i]))

        if choice_b == quiz_b_ans[i]:
            easygui.msgbox("Congradulation you got the answer correct")
            score += 1
        else:
            easygui.msgbox("Sorry, you got it wrong the right answer was {} \
            ".format(quiz_b_ans[i]))



if age >= 5 and age <=7:
        quiz_a()

if age >=8 and age <=11:
        quiz_b()


if age > 11:
        choices = ["Continue","Exit"]
        button_1 = buttonbox ("Your too old for this quiz would you like to \
        exit or continue anyways", choices = choices)

        if button_1 == choices[0]:
                quiz_b2()

        if button_1 == choices[1]:
                sys.exit()


if age < 5:
        choices = ["Continue","Exit"]
        button_2 = buttonbox ("Your too young for this quiz would you like \
        to exit or continue anyways", choices = choices)

        if button_2 == choices[0]:
                quiz_a2()

        if button_2 == choices[1]:
                sys.exit()
...