首页 > 其他 > 详细

tk画图

时间:2015-09-30 09:35:34      阅读:301      评论:0      收藏:0      [点我收藏+]

 

技术分享
 1 """
 2 programming pytyon page 422 
 3 pop up three new windows ,with style
 4 desctory() kill one window,quit kill all windows and app
 5 top-level window have litle,icon,iconify/deiconify and protocol for wn events
 6 there always is an application root window,whether by default or created as an
 7 explicit tk() object;all top-level windows are containters but they are never
 8 packed.gridded;toplevel is like Frame,but a new window,and can have a menu;
 9 """
10 from Tkinter import *
11 root =Tk()
12 trees =[(the larch!,light blue),(the pine!,light green),(the giant redwood,red)]
13 
14 for (tree,color) in trees:
15     win = Toplevel(root)
16     win.title(sing...)
17     win.protocol(WM_DELETE_WINDOW,lambda:None)                           #ignore close,so no meaning to close win by X
18     win.iconbitmap(C:\\Users\\xlian7164584\\Documents\\GitHub\\R_D\\bg.ico)
19     
20     msg =Button(win,text=tree,command=win.destroy)
21     msg.pack(expand=YES,fill=BOTH)
22     msg.config(padx=10,pady=10,bd=10,relief=RAISED)
23     msg.config(bg=black,fg=color,font=(times,30,bold italic))
24 root.title(lxk demo with three win)
25 Label(root,text=main win,width=30).pack()
26 Button(root,text=quit all,command=root.quit).pack()
27 root.mainloop()
View Code

 

技术分享

tk画图

原文:http://www.cnblogs.com/lxk613/p/4848223.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!