버튼이있는 다른 프레임 위에있는 프레임 안에 트리 뷰가 있습니다. 창 크기를 조정할 때 위쪽 프레임을 확장하고 싶지만 단추 프레임을 그대로 유지하면됩니다. 파이썬 2.7.5에서Tkinter/ttk를 사용하여 다른 위젯을 잠그는 동안 수직 위젯 하나를 확장하십시오.
코드 :
class MyWindow(Tk.Toplevel, object):
def __init__(self, master=None, other_stuff=None):
super(MyWindow, self).__init__(master)
self.other_stuff = other_stuff
self.master = master
self.resizable(True, True)
self.grid_columnconfigure(0, weight=1)
self.grid_rowconfigure(0, weight=1)
# Top Frame
top_frame = ttk.Frame(self)
top_frame.grid(row=0, column=0, sticky=Tk.NSEW)
top_frame.grid_columnconfigure(0, weight=1)
top_frame.grid_rowconfigure(0, weight=1)
top_frame.grid_rowconfigure(1, weight=1)
# Treeview
self.tree = ttk.Treeview(top_frame, columns=('Value'))
self.tree.grid(row=0, column=0, sticky=Tk.NSEW)
self.tree.column("Value", width=100, anchor=Tk.CENTER)
self.tree.heading("#0", text="Name")
self.tree.heading("Value", text="Value")
# Button Frame
button_frame = ttk.Frame(self)
button_frame.grid(row=1, column=0, sticky=Tk.NSEW)
button_frame.grid_columnconfigure(0, weight=1)
button_frame.grid_rowconfigure(0, weight=1)
# Send Button
send_button = ttk.Button(button_frame, text="Send",
command=self.on_send)
send_button.grid(row=1, column=0, sticky=Tk.SW)
send_button.grid_columnconfigure(0, weight=1)
# Close Button
close_button = ttk.Button(button_frame, text="Close",
command=self.on_close)
close_button.grid(row=1, column=0, sticky=Tk.SE)
close_button.grid_columnconfigure(0, weight=1)
나는 이런 식으로 다른 인스턴스를 만들 :
내가 시도 무엇window = MyWindow(master=self, other_stuff=self._other_stuff)
: 에만 버튼이 사라 만든 사이즈 변경 잠금 시도. 나는 또한 주변의 변화하는 무게를 시도했지만 현재의 구성은 모든 것이 화면에 나타나는 유일한 방법이다.
.
. 그리드에 대해 더 잘 이해하고 어떻게 작동하는지, 감사합니다! – vaponteblizzard