Wednesday, March 18, 2015

python with de facto GUI library. standard library Tk


from Tkinter import *

def bClick():
    t.set(t2.get())

root = Tk()
t = StringVar()
t2 = StringVar()

# create UI elements
label = Label(root, textvariable=t)
entry = Entry(root, textvariable=t2)
b = Button(root, text="Click Me!", command = bClick)

# layout UI elements
label.pack()
entry.pack()
b.pack()

t.set("Hello Label");

root.mainloop()

No comments: