I have this problem: I created this program with Python3 and Tkinter, that show the picture of a place (like mountain or sea) and the program speak what is the place shown in the picture. The problem is when the picture change, it only appears for a few moments, just the time the program say what place is, and the disappear and remain only the label where it is written what represent the picture. This is the code:
from tkinter import *
from PIL import Image,ImageTk
import pyttsx3
root = Tk()
root.title("Try change image")
root.geometry("1000x600")
root.resizable(height=FALSE,width=FALSE)
Leftframe = Frame(root)
Leftframe.pack(side = LEFT)
Rightframe = Frame(root)
Rightframe.pack(side=RIGHT)
engine = pyttsx3.init()
voices = engine.getProperty('voices')
rate = engine.getProperty('rate')
engine.setProperty('rate', rate -20)
for voice in voices:
engine.setProperty('voice',voice.id)
def start():
global back_label,label
back = ImageTk.PhotoImage(file=directory mountain picture)
back_label = Label(Leftframe,image = back)
back_label.pack()
label=Label(Rightframe,text="Mountain")
label.pack()
root.update()
engine.say("Mountain")
engine.runAndWait()
def change():
back_label.destroy()
label.destroy()
back = ImageTk.PhotoImage(file=directory sea picture)
back_label1 = Label(Leftframe,image = back)
back_label1.pack()
label1 = Label(Rightframe,text="Sea")
label1.pack()
root.update()
engine.say("Sea")
engine.runAndWait()
start()
change()
root.mainloop()
I hope you understand what I want to do, every help will be appreciated