i am trying to have python display an image when you request for that image. i have used the following code which works fine:
from tkinter import*
window = Tk()
window.title ('R,P,S')
c=Canvas(window,width=300, height=300, bg='yellow')
c.pack()
user = input("please type rock, paper, scissors: ")
if user == "rock":
image = PhotoImage(file = 'rock.gif')
c.create_image(150, 150, image = image)
elif user == "paper":
image = PhotoImage(file = 'paper.gif')
c.create_image(150, 150, image = image)
else:
image = PhotoImage(file = 'scissors.gif')
c.create_image(150, 150, image = image)
i have the gif images i created in the same folder director as the python program.
however when i try to use a type of loop if ignores the commands to display image when requested from the user.
for example:
for i in range (3):
or
while True:
Why does it ignore the image command when in a loop?
what i would like is to allow the user to have the option to select each image so it would be: Please type rock, paper, scissors: rock (displays rock image) Please type rock, paper, scissors: paper (displays paper image) Please type rock, paper, scissors: scissors(displays scissors image)
with out the need to restart the shell.