My goal: is to make a choice-based story so far I only made the first 2 pictures which would be the main picture and 2 choices which lead to another picture with choices, like an RPG with choices.
so far everything is alright: I used buttons, tkinter.PhotoImage. But it shows 4 buttons from the start
My question is: How to implement choices or some sort of stuff so the first picture will have 2 buttons, and it will lead to another picture with 4choices=4buttons or something
Here is my code to the end, note it is in hungarian
from random import *
canvas=tkinter.Canvas(height=500, width=500)
canvas.pack()
#first picture
elso=tkinter.PhotoImage(file='first.png')
#second picture is first choice from the first picture
masodik=tkinter.PhotoImage(file='second.png')
#third picture is second choice from the first picture
harmadik=tkinter.PhotoImage(file='third.png')
def square():
canvas.create_rectangle(200, 400, 300, 500)
def secondsquare():
canvas.create_rectangle(200, 300, 300, 400)
def button1_klik():
canvas.create_image(250, 200, image=elso)
def button2_klik():
canvas.create_image(250, 200, image=masodik)
def button3_klik():
canvas.create_image(250, 200, image=harmadik)
def button4_klik():
canvas.create_rectangle(250, 500, 500, 800, fill='blue')
button1 = tkinter.Button(text='1válasz', command=button1_klik)
button1.pack()
button2=tkinter.Button(text='2válasz', command=button2_klik)
button2.pack()
button3=tkinter.Button(text='3valasz', command=button3_klik)
button3.pack()
button4=tkinter.Button(text='4valasz', command=button4_klik)
button4.pack()