Tkinter hat das Checkbutton Objekt zur Darstellung einer Checkbox.
import tkinter as tk
from tkinter import ttk
def show_selected():
selected_options = [var1.get(), var2.get(), var3.get()]
print("Selected options:", selected_options)
root = tk.Tk()
root.title("Kontrollkaestchen Beispiel")
var1 = tk.BooleanVar()
var2 = tk.BooleanVar()
var3 = tk.BooleanVar()
checkbutton1 = ttk.Checkbutton(root, text="Option 1", variable=var1)
checkbutton2 = ttk.Checkbutton(root, text="Option 2", variable=var2)
checkbutton3 = ttk.Checkbutton(root, text="Option 3", variable=var3)
checkbutton1.pack()
checkbutton2.pack()
checkbutton3.pack()
show_button = tk.Button(root, text="Angekreuzte Optionen anzeigen", command=show_selected)
show_button.pack()
root.mainloop()