import tkinter as tk
from tkinter import ttk
win = tk.Tk()
win.title("Python GUI")
a_label = ttk.Label(win, text="A Label")
a_label.grid(column=0, row=0)
def click_me():
action.configure(text="Hello " + name.get())
a_label.configure(foreground='red')
a_label.configure(text="A Red Label")
action = ttk.Button(win, text="Click Me!", command=click_me)
ttk.Label(win, text="Enter a name:").grid(column=0, row=0)
name = tk.StringVar()
name_entered = ttk.Entry(win, width=12, textvariable=name)
name_entered.grid(column=0, row=1)
win.mainloop()
#http://www.pyinstaller.org/
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.