我正在寻找一种方法,使Tkinter帧在调整大小时有点像这样:
from Tkinter import *
w = Tk()
w.aspect(1,1,1,1)
w.mainloop()
所以我想要这里的代码:
import Tkinter as tk
from Tkconstants import *
r=tk.Tk()
content_frame=tk.Frame(r,borderwidth=5,relief=GROOVE)
content_frame.grid(row=0,column=0,sticky=(N,S,E,W))
tk.Label(content_frame,text='content').pack()
pad_frame=tk.Frame(r,borderwidth=5,relief=GROOVE)
pad_frame.grid(row=1,column=0,sticky=(N,S,E,W))
tk.Label(pad_frame,text='-pad-').pack()
r.rowconfigure(0, weight=1)
r.rowconfigure(1, weight=1)
r.columnconfigure(0, weight=1)
r.mainloop()
它基本上创建了两个帧,一个应该包含一些内容(在我的应用程序中,这个帧包含一个可以调整大小的mathplotlib图),另一个仅仅用于填充。
按照以下规则调整大小:
有什么想法吗?我已经看了一段时间的手册,似乎找不到合适的东西。
-丹尼尔
目前没有回答
相关问题 更多 >
编程相关推荐