2007年06月28日 星期四 17:29
# -*- coding:cp936 -*-
from Tkinter import *
root = Tk()
root['width'] = root.winfo_screenwidth()
root['height'] = root.winfo_screenheight()
# Èç¹ûÈ¥³ýÕâÒ»ÌõÓï¾ä£¬³öÏֵĴ°¿Ú²¼ÂúÕû¸öÆÁÄ»£»·ñÔò£¬Ö»ÓÐÒ»¸öССµÄ´°¿Ú
Label(root, text = 'hello, Tkinter!', anchor = NW).pack()
root.mainloop()
----------------------------------------------------------------------------------------------------------------------
hi, all,
ÓÐÈçÉÏ´úÂ룬ĿµÄÊÇÏëÔÚÔËÐÐʱ°Ñ´°¿Ú×î´ó»¯¡£µ«·¢ÏÖÖ»Òªpack/grid/placeÒ»¸öwidgetµ½root£¨ÈçÉÏ£©£¬¾Í»áʹµÃ×î´ó»¯ÎÞЧ¡£
Çëtkinter¸ßÊÖ³öÊÖ£¬°ïһϡ£²»Òª½¨ÒéÎÒʹÓÃwxPythonºÍPyQt4Ö®ÀàµÄ£¬ÒòΪÈô¸ÉÔÒò£¬ÎÒ±ØÐëʹÓÃTkinter£¬Ð»Ð»¡£
˵
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070628/391b9e8f/attachment.htm
2007年06月28日 星期四 19:21
On 6/28/07, lai yonghao <lanphaday在gmail.com> wrote: > # -*- coding:cp936 -*- > from Tkinter import * > > root = Tk() > > root['width'] = root.winfo_screenwidth() > root['height'] = root.winfo_screenheight() > > # 如果去除这一条语句,出现的窗口布满整个屏幕;否则,只有一个小小的窗口 > Label(root, text = 'hello, Tkinter!', anchor = NW).pack() > root.mainloop() > > ---------------------------------------------------------------------------------------------------------------------- > hi, all, > > 有如上代码,目的是想在运行时把窗口最大化。但发现只要pack/grid/place一个widget到root(如上),就会使得最大化无效。 > > 运行以后默认最大化? 改 Label(root, text = 'hello, Tkinter!', anchor = NW, width=root['width'], height=root['height']).pack()
Zeuux © 2025
京ICP备05028076号