Tkinter Designer

← All templates

To-do list template for tkinter

Open this design in the browser-based designer, rearrange it, and download the Python. Nothing to install, and you don't need an account to try it.

Open in designer →

What this template shows you

  • Adding items to a Listbox with .insert("end", …)
  • Reading the selected row with .curselection()
  • Deleting Listbox rows

The Python it generates

This is the actual main.py you get when you download it: standard-library tkinter, no framework, yours to edit:

import tkinter as tk
from tkinter import ttk


class Application:
    def __init__(self, root):
        self.root = root
        root.title("To-do list")
        root.geometry("380x340")

        self.entry1 = tk.Entry(root)
        self.entry1.place(x=20, y=20, width=240, height=28)

        self.button1 = tk.Button(root, text="Add", command=self.on_button1)
        self.button1.place(x=275, y=17, width=85, height=34)

        self.listbox1 = tk.Listbox(root)
        self.listbox1.insert("end", "Feed the cat")
        self.listbox1.insert("end", "Finish homework")
        self.listbox1.place(x=20, y=65, width=340, height=210)

        self.button2 = tk.Button(root, text="Remove selected", command=self.on_button2)
        self.button2.place(x=20, y=288, width=140, height=34)

    def on_button1(self):
        task = self.entry1.get().strip()
        if task:
            self.listbox1.insert("end", task)
            self.entry1.delete(0, "end")

    def on_button2(self):
        selected = self.listbox1.curselection()
        if selected:
            self.listbox1.delete(selected[0])


if __name__ == "__main__":
    root = tk.Tk()
    app = Application(root)
    root.mainloop()

Save it and run it the usual way:

python main.py

Make it your own. Edit the layout visually, then download the code.

Open the to-do list template →

Other templates

  • Login form: Username + password entries with a working submit handler.
  • Calculator: Display plus a 4×4 keypad with working press/clear/equals code.
  • Temperature converter: The classic beginner project: Celsius in, Fahrenheit out.
  • Quiz app: Multiple-choice question with radiobuttons and answer checking.