Saturday, July 16, 2011

I love Tkinters grid manager!

I wrote a simple GUI, and used the grid manager to arrange the widgets. I think I am going to like it better than Tkinter's pack.

from Tkinter import *
#I love Tkinter's grid manager! This is a simple example.
root = Tk()

def startVirus():
    print('Erasing hard drive now.')

Label(root, text="First").grid(row=0)
Label(root, text="Second").grid(row=1)

ent = Entry(root)
ent2 = Entry(root)

ent.grid(row=0, column=1)
ent2.grid(row=1, column=1)

btn = Button(root,text='Start the Virus',command=startVirus)
btn.grid(row=3, column=1)
root.mainloop()

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
Biking helps me to cope with life.