- 論壇徽章:
- 0
|
程序代碼如下:- #!/usr/bin/python
- #-*- encoding:utf8 -*-
- import Tkinter
- class mainWindow:
- def __init__(self,master):
- self.top=master
- self.bottom=Tkinter.Button(self.top,text="test",width=4)
- self.bottom.pack()
- self.top.bind('<Configure>',self.resize)
-
- def resize(self,event):
- print "change:",event.width
- if __name__=="__main__":
- root=Tkinter.Tk()
- newwindow=mainWindow(root)
- root.mainloop()
復(fù)制代碼 測試情況如下:
從窗口右下角處拖得更改窗口大小,發(fā)現(xiàn)返回的width有的時候突然很小(一直往右拖動的),請教一下各位這是什么原因。
無標(biāo)題.png (30.17 KB, 下載次數(shù): 13)
下載附件
2014-05-20 14:21 上傳
|
|