Python Tkinter
import tkinter as tk

root = tk.Tk()
root.title("Counter")
clicks = tk.IntVar(value=0)

tk.Label(root, textvariable=clicks, font=("Segoe UI", 24)).pack(padx=40, pady=12)
tk.Button(root, text="Click me", command=lambda: clicks.set(clicks.get() + 1)).pack(pady=12)

root.mainloop()

Press Run or Ctrl ↵ to execute main.py.
Type program input here while it runs.

Python Tkinter

Tkinter Online Compiler

Write a tkinter program and its windows open in the Window tab beside the editor, where you can click, type and use them like a desktop app. It runs in your browser with nothing to install, on Windows, macOS, Linux and Chromebooks.

Windows are drawn to look like tkinter on Windows 10 and 11, whichever theme the site is in, so what you build here looks close to what you get on a Windows computer.

Try it above

What works

  • Tk, Toplevel, Frame, Label, Button, Entry, Text, Listbox, Canvas, Scrollbar, Checkbutton, Radiobutton, Scale, Spinbox and Menu.
  • ttk widgets including Combobox, Notebook, Treeview and Progressbar, with the Windows look.
  • pack, grid and place; bind() for keys and the mouse; after() for timers; StringVar, IntVar and friends.
  • messagebox, simpledialog and colorchooser open inside the window and return the answer, as on a desktop. File dialogs open and save in the program’s folder, beside your other files.

print() goes to the output under the window. The Examples menu in the Window tab opens finished apps (a calculator, a notepad with menus, a contacts table) and runs them.

A form with a message box

Python Tkinter
import tkinter as tk
from tkinter import ttk, messagebox

root = tk.Tk()
root.title("Sign up")

ttk.Label(root, text="Name").grid(row=0, column=0, padx=8, pady=6, sticky="w")
name = ttk.Entry(root, width=24)
name.grid(row=0, column=1, padx=8, pady=6)

def submit():
    if name.get().strip():
        messagebox.showinfo("Welcome", f"Hello, {name.get().strip()}!")
    else:
        messagebox.showwarning("Missing name", "Please type your name.")

ttk.Button(root, text="Sign up", command=submit).grid(row=1, column=1, padx=8, pady=8, sticky="e")
root.mainloop()

Questions

Do I need Python on my computer?

No. Python runs in your browser tab through Pyodide, and your window opens next to your code.

Is this real tkinter?

A browser has no Tk, so import tkinter gets a version built for it, with the same classes, options and methods. A program you write here also runs on your computer.

What is missing?

Tcl itself, so tk.call() and eval() do very little, along with embedding other programs’ windows and tray icons. Text tags change colours and underlining but not fonts, and PhotoImage reads PNG and GIF only.

Is it free?

Yes. Tkinter runs in your browser, so it works on every plan.