Tkinter: Difference between revisions

No edit summary
Line 2: Line 2:


==Images==
==Images==
To display an image:
To display an image
{{ hidden | Example |
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
import tkinter as tk
import tkinter as tk
Line 27: Line 28:
canvas.itemconfigure(canvas_image, image=photo_img)
canvas.itemconfigure(canvas_image, image=photo_img)
</syntaxhighlight>
</syntaxhighlight>
 
}}
;Notes
;Notes
* Make sure the <code>ImageIk.PhotoImage</code> does not get garbage collected.
* Make sure the <code>ImageIk.PhotoImage</code> does not get garbage collected.