这个小部件的作者使用了一个不必要的动作:这个小部件设置了最小的 根 窗口大小,并且他假定它是程序中唯一的窗口(这不是bug,它是功能)。
1.In方法
def __place_widgets(self):
self._calendar = ttk.Treeview(show='', selectmode='none', height=7)
应该:
self._calendar = ttk.Treeview(self, show='', selectmode='none', height=7)
2.在构造函数中删除行:
self._calendar.bind('<Map>', self.__minsize)3.删除
__minsize方法
4.如果要设置最小大小以
root2使用此代码:
def myfunction(): root2=Tkinter.Toplevel(root) ttkcal = Calendar(root2,firstweekday=calendar.SUNDAY) ttkcal.pack(expand=1, fill='both') root2.update() root2.minsize(root2.winfo_reqwidth(), root2.winfo_reqheight())



