Answers for "tkinter code example"

8

tkinter basic

from tkinter import Tk, Label, Button

class MyFirstGUI:
    def __init__(self, master):
        self.master = master
        master.title("A simple GUI")

        self.label = Label(master, text="This is our first GUI!")
        self.label.pack()

        self.greet_button = Button(master, text="Greet", command=self.greet)
        self.greet_button.pack()

        self.close_button = Button(master, text="Close", command=master.quit)
        self.close_button.pack()

    def greet(self):
        print("Greetings!")

root = Tk()
my_gui = MyFirstGUI(root)
root.mainloop()
Posted by: Guest on May-15-2020
2

tkinter python tutorial

button = tk.Button(
    text="Click me!",
    width=25,
    height=5,
    bg="blue",
    fg="yellow",
)
Posted by: Guest on January-01-2021
1

tkinter tutorial

text_box.insert(tk.END, "Put me at the end!")
Posted by: Guest on December-19-2020

Python Answers by Framework

Browse Popular Code Answers by Language