import tkinter as tk
root = tk.Tk()
my_paned_window = tk.PanedWindow(master=root)
frame1 = tk.Frame(master=my_paned_window, bg='snow')
frame2 = tk.Frame(master=my_paned_window)
tk.Label(master=frame1, text='frame1').pack()
tk.Label(master=frame2, text='frame2').pack()
my_paned_window.add(frame1)
my_paned_window.add(frame2)
my_paned_window.pack(fill=tk.BOTH)
root.mainloop()
在上面的代码中,我不希望frame1在拖动时扩展太多。我该如何设置此限制
没有直接的方法可以做到这一点。您可以通过为frame2设置
minsize
来实现这一点大概是这样的:
另一种方法是
return "break"
当窗扇位置大于最大宽度时,使其无法再移动最简单的例子:
相关问题 更多 >
编程相关推荐