Python Tkinter将窗口动态调整为内容

时间:2017-01-01 19:06:21

标签: python tkinter

我一直在浏览,我想根据标签中输入的内容动态调整活动Tkinter窗口的大小。

enter image description here

但是,如何根据返回的数据量动态调整此窗口的大小,如下所示。

enter image description here

My Current Tkinter设置;

#Create Window
root = Tk()

root.title("Customer Details")
#Resize Window
root.geometry("375x125+300+300")
#Creste Element frames
TopFrame = Frame(root)
TopFrame.pack()
MiddleFrame = Frame(root)
MiddleFrame.pack()

#Track load elements
View = Button(TopFrame, text='View',command=View, padx=15)
Cust = Entry(TopFrame, text="Waiting..", fg="black", justify='center')
View.pack(pady=5, fill=BOTH, side=RIGHT)
Cust.pack(side=LEFT)

CurrentStatus = Label(MiddleFrame, text="Waiting for customer!", fg="black", justify='left')
CurrentStatus.pack(fill=BOTH, expand=YES)

#Loop Window to make sure it doesn't disappear
root.mainloop()

任何帮助都会很棒,谢谢。

0 个答案:

没有答案