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()

 

 

 

 

 

 

 

 

 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值