Как мне вставить текст в фоновое изображение? - PullRequest
0 голосов
/ 28 февраля 2020

Извините, если вопрос странный, я сделал только пару небольших вещей в Python. В настоящее время я работаю над выбором собственного приключения для школьного проекта и хочу сделать что-то вроде GUI. Я сделал фоны с пробелами для текста, и сейчас я пытаюсь найти способ создать воображаемое текстовое поле, встроенное в изображение, где появляется текст. Вот что у меня сейчас:

root = tkinter.Tk()

    canvas = tkinter.Canvas(root, width=960, height=720)
    image = ImageTk.PhotoImage(Image.open('TitleScreen.png'))

    canvas.create_image(0, 0, anchor=tkinter.NW, image=image)
    canvas.pack()

    root.mainloop()

    text = tkinter.Label(root, text=(
    answer == input('You live in Valencia, Venezuela. You have 2 kids, and a significant other. You barely have enough '
            'money to take care of your family, food is running out, and electricity outages are a daily '
            'occurrence. Do you want to leave in search of a better life? [y/n]')
    if answer.lower().strip() == 'y':
        answer = input('Great, good decision. First should you prepare for the trip by buying supplies? [y/n]')
        if answer.lower().strip() == 'y' :
            print('Trick question there is a food shortage. Oh well, I guess you\'ll have to hope for the best.')
        elif answer.lower().strip() == 'n' :
            print('Cool. If your family starves to death just remember it is 100% your fault')
    # add option to restart

    answer = input('You hope to at least make it to Colombia first. Do you go to Araure [a] or Calabozo [b]?')
    if answer.lower().strip() == 'a' :
        Player = 1
    elif answer.lower().strip() == 'b' :
        Player = 2
    ))
text.pack()

Я получаю эту ошибку:

line 80
if answer.lower().strip() == 'y':
                                    ^
SyntaxError: invalid syntax
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...