How to update an image on a Canvas?

后端 未结 2 576
滥情空心
滥情空心 2020-11-29 05:39

This is the essence of the code I\'m having trouble with:

camelot = Canvas(main, width = 400, height = 300)
camelot.grid(row = 0, column = 0, rowspan = 11,          


        
2条回答
  •  孤独总比滥情好
    2020-11-29 06:15

        MyImage = PhotoImage(file = "sample1.gif")
        labelorbuttontodisplayit.image = MyImage
        labelorbuttontodisplayit.configure(image=MyImage)
    

    :P that should do it. I only tried to use that code on label or buttons, never as a Canvas, but i guess you can adapt that piece of code a bit.

提交回复
热议问题