¿¿como puedo actualizar una imagen en Tkinter ??
Publicado por diego (1 intervención) el 08/12/2014 03:32:51
necesito ayuda. básicamente necesito poner una imagen en mi programa y cuando apreto un boton, quiero que la imagen se actualice. Pero cuando lo intento, en lugar de la nueva imagen, solo hay un cuadrado gris. Que puedo hacer ?
from Tkinter import*
w=Tk()
w.geometry('500x500+100+100')
w.title('new file')
def Change():
----photo2=PhotoImage(file='The Days.gif')
----lblFondo2=Label(w,image=photo2).place(x=70,y=70)
photo=PhotoImage(file='Warriors.gif')
lblFondo=Label(w,image=photo).place(x=50,y=50)
btn=Button(w,text='change image',width=22,font=('Arial',12),cursor='center_ptr',
command=Change,activebackground='grey').place(x=10,y=400)
w.mainloop()
from Tkinter import*
w=Tk()
w.geometry('500x500+100+100')
w.title('new file')
def Change():
----photo2=PhotoImage(file='The Days.gif')
----lblFondo2=Label(w,image=photo2).place(x=70,y=70)
photo=PhotoImage(file='Warriors.gif')
lblFondo=Label(w,image=photo).place(x=50,y=50)
btn=Button(w,text='change image',width=22,font=('Arial',12),cursor='center_ptr',
command=Change,activebackground='grey').place(x=10,y=400)
w.mainloop()
Valora esta pregunta


0