1. Pyroom
  2. Tutorials
  3. Python Tkinter

Python Tkinter

Pyroom runs Tkinter programs in the browser, so students can build real windows, buttons, forms and games without installing anything.

When to use it

Use Tkinter when students are ready to build interactive apps: a calculator, a quiz, a form that checks input, or a simple game on a Canvas.

Your first window

Import tkinter, create a window with Tk(), add widgets and start the main loop. The window appears in the preview panel next to the console.

import tkinter as tk
root = tk.Tk()
tk.Button(root, text="Click me", command=lambda: print("Hi!")).pack()
root.mainloop()

Widgets and events

  • Label shows text; Entry reads what the user types; Button runs a function when clicked.
  • Layout managers pack() and grid() arrange widgets in rows and columns.
  • A Canvas draws shapes you can move, which is the base for simple games.
  • bind() connects keys and mouse clicks to your functions.

Learning path

The Beginner tutorial builds a window with a button. The Intermediate tutorial makes a small form with Entry and Label that responds to input. The Advanced tutorial moves a shape on a Canvas with the keyboard β€” a first mini-game.

Good to know

Pyroom's Tkinter follows standard Python behaviour, so the code also runs in desktop Python. Programs keep running until you stop them or close the window. For bigger Tkinter projects with many files, use Pro Mode or LaunchPad.

Feature overview β†’

Beginner

Make a Tkinter window with a button

Beginner

Beginner Video coming soon. The steps below show everything the video will cover.

Build your first Python GUI with Tkinter in the browser: create a window, add a button and run a function when it is clicked.

Open tutorial β†’

Intermediate

Advanced

Make a Tkinter Canvas mini-game

Advanced

Advanced Video coming soon. The steps below show everything the video will cover.

Build a tiny game with Python Tkinter: draw a player on a Canvas, bind arrow keys and move it with canvas.move(). Advanced tutorial.

Open tutorial β†’

All tutorials β†’

Try it in the Playground

Nothing to install and no account needed.

Open Playground β†’