Skip to content

Updated: 30/11/2026

tkinter in the browser

A program with a window, buttons and text fields is a big step for a student: the code stops being a list of commands run top to bottom and starts reacting to events. In Python the simplest way there is tkinter from the standard library. In BitWizards everything runs in a browser tab: you write code, click Run and the app window appears next to the editor, ready to be clicked, typed into and closed with the X.

Course: Python desktop apps, tkinter step by step - first lesson (lessons are in Polish)

Window and widgets

Regular import tkinter as tk code works: a tk.Tk() window with a title and size, the Label, Button, Entry, Text, Checkbutton, Radiobutton, Scale, Spinbox, Listbox, Frame, LabelFrame and Toplevel widgets, the bg, fg, font, width and state options, and StringVar, IntVar, DoubleVar, BooleanVar. Layout is computed like Tk: pack (sides, fill, expand), grid (rows, columns, sticky, columnspan, weights) and place. messagebox and simpledialog dialogs show up above the app window, and root.after() works as a timer. There is also a Canvas you can draw on with the mouse, a menu bar and context menus, ttk widgets (Combobox, Treeview, Notebook, Progressbar) and filedialog file pickers.

print goes to the console under the window, and an error in an event handler is printed just like in regular Python (“Exception in Tkinter callback”) without closing the app.

Step-by-step course

Python desktop apps: tkinter step by step (14 topics, 110 examples and tasks) goes from the first window to games and apps with files: the first window and labels, buttons and events, text fields and numbers, pack and grid layout with frames, check boxes, sliders and spinboxes, message boxes and questions, Listbox lists, and projects (a unit converter, a sign-up form with validation, a grade book, a stopwatch with after, an app written as a class), then drawing and animation on a Canvas (a coin-catching game), menus and Toplevel windows, ttk widgets, files with filedialog, and larger projects (a calculator, tic-tac-toe, a quiz from a file). Code uses English identifiers; the texts users see are in Polish.

Checked like a user

A tkinter task has a two-part rule:

  • window widgets - type, variable name (also app.label in an app written as a class), text, options (e.g. bg="green", show="*"), layout position (grid(row=0, column=1), pack(side="left")) and the frame it sits in,
  • scenarios - steps on the running program: type, click, press a key, tick, move a slider, pick from a list, answer a message box, wait (the after clock is virtual, so a minute takes a moment), close the window, then expect a label, a list size, a selection, a widget option or a message.

Checking runs after every Run and does not disturb the student’s running app. A failed condition is explained: which scenario, what was expected and what the window showed.

For teachers

  • Your own tasks with a tk rule: starter code and a JSON rule with an example to adapt, checked by the same engine as the course.
  • Student work history and live view during the lesson, as in other tasks.
  • Timed mock exams with tab-switch signals.

Limitations

To be honest about what is missing: PhotoImage pictures from files, ttk.Style themes (ttk widgets look like Windows 10), dragging windows and resizing them with the mouse (geometry sets the size), the system clipboard and libraries outside the standard library (e.g. customtkinter, PIL). The window looks like Windows, but is not pixel-identical.

Python - INF.04 exam - WPF - Computer science matura

Frequently asked questions

Do I need to install Python?

No. Python runs in the browser (Pyodide) and the tkinter app window appears next to the editor, also on school computers and Chromebooks. Course lessons open without signing in; with an account, work is saved automatically.

Is it real tkinter?

The code is plain Python and plain tkinter: the same classes (Tk, Label, Button, Entry, Listbox...), the pack, grid and place methods, StringVar and IntVar, messagebox and simpledialog. There is no Tcl/Tk library in a browser, so tkinter is a stand-in: the browser draws the window and the layout is computed like Tk on Windows. A program copied from BitWizards works the same in regular Python on a computer.

How are tasks checked?

The checker runs the program, inspects the window widgets (type, variable name, text, colors, grid cell) and clicks through the app like a user: it types text, presses buttons and Enter, ticks boxes, moves sliders, picks list items, answers message boxes and waits for after() timers. Then it compares labels, lists and messages. Each scenario starts from a freshly launched program.

tkinter or WPF?

Both teach event-driven desktop programs. tkinter is Python from the standard library, good for high school and as a first step; WPF is C# and XAML from Visual Studio, typical in Polish technical schools for INF.04. In BitWizards both run in the browser.

Start now

BitWizards is free. Try the demo without signing in, or sign in to the app to save your progress.

See how to get started