python练习

##for item in ['e-mail', 'net-surfing', 'homework', 'chat']:
## print (item)
## 
import tkinter
from tkinter import *

##top = tkinter.Tk()
####label = tkinter.Label(top, text = 'hello world!')
####label.pack()
##quit = tkinter.Button(top, text = 'hello world!', command = top.quit(), bg='red', fg = 'white')
##quit.pack(fill = tkinter.X, expand=1)
##tkinter.mainloop()

##def resize(ev = None):
##        label.config(font = 'Helvetica -%d bold' &scale.get())
##top = Tk()
##top.geometry('250x150')
##
##label = Label(top, text = 'hello world!',font = 'Helvetica -12 bold')
##label.pack(fill = Y, expand=1)
##
##scale = Scale(top, from_= 1, to = 40, orient = HORIZONTAL, command = resize)
##scale.set(12)
##scale.pack(fill=X,expand=1)
##
##quit = Button(top,text='QUIT',command=top.quit,activeforeground='white',activebackground='red')
##quit.pack()
##mainloop()

root = Tk()
root.title('Toplevel')

##Label(root, text='This is the main Toplevel').pack(pady=10)
##t1 = Toplevel(root)
##print(t1)
##Label(t1, text='This is a child of root').pack(padx=10,pady=10)
##t2 = Toplevel(root)
##print(t2)
##Label(t2, text='This is a transient window of root').pack(padx=10,pady=10)
##print(t2.transient(root))
##for relief in [RAISED,SUNKEN,FLAT,RIDGE,GROOVE,SOLID]:
##        f = Frame(root, borderwidth=2,relief=relief)
##        Label(f, text=relief,width=10).pack(side=LEFT)
##        f.pack(side=LEFT,padx=5,pady=5)

##Label(root,text='wangpei').pack(pady=10)
##Button(root,text='wangjin',state=DISABLED).pack(side=LEFT)
##Button(root,text='niuna',cmmand=root.quit()).pack(side=RIGHT)

##Label(root,text='anagram:').pack(side=LEFT,padx=5,pady=10)
##e = StringVar()
##Entry(root,width=40,textvariable=e).pack(side=LEFT)
##e.set('xxxxxxxxxxx')


for castmember,row,col,status in[('001',0,0,NORMAL),
                                 ('002',0,1,NORMAL),
                                 ('003',1,0,DISABLED),
                                 ('004',1,1,NORMAL),
                                 ('005',2,0,NORMAL),
                                 ('006',2,1,NORMAL)]:
        print(castmember)
        print(row)
        print(col)
        var = IntVar()
##        setattr(root,castmember,IntVar())getattr(root,castmember)
        Checkbutton(root,text=castmember,state=status,anchor=W,
            variable=var).grid(row=row,column=col,sticky=W)
mainloop()

 

 

 

 

 

 

 

 

 


 

你可能感兴趣的:(python,command,homework,button,import)