How to update an image in Tkinter

Asked

Viewed 60 times

0

Hello, I would like to know how to have an image on my button when I press it and another image when it is not being pressed.

  • What have you tried? There’s some code?

  • I did this to test: img1 = Imagetk.Photoimage(Image.open('sss.png')) def test(): img2 = Imagetk.Photoimage(Image.open('ss.png')) tutu.configure(image=img2) tutu.image = img2 tutu = Button(image=img1, command=test) tutu.grid() I want after I click on the button it to switch to ss.png and then go back to his initial image to sss.png

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.