Tkinter Button

  • Post category:Tkinter

In this Tkinter tutorial, you will learn how to add a Tkinter button.

# import Tkinter Module
import tkinter as tk

# create main window
var = tk.Tk()

# Set title
var.title("My Tkinter")

# create a button
var2 = tk.Button(var, text="Click Me, First button")

# pack button
var2.pack()

# start the event loop
var.mainloop()

Output:

Free resources to learn advanced skills: AiHints and CodeAllow