Tkinter: Difference between revisions

From David's Wiki
No edit summary
Line 37: Line 37:
To accomplish this, use <code>.after</code>.
To accomplish this, use <code>.after</code>.


{{ hidden | Example |
{{ hidden | Example |
{{ hidden | Example |
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">

Revision as of 16:38, 1 February 2021

Tkinter is a Python API for the Tk GUI. It is built into the Python standard library and is cross platform.

Images

To display an image, create a tk.Canvas and then use canvsa.create_image.

Example
Notes
  • Make sure the ImageIk.PhotoImage does not get garbage collected.

Animation Loop

For interactive applications, you may want an animation loop called every few milliseconds.
To accomplish this, use .after.

Example