I am using this code to create a simple calendar on my Tkinter. When i put a calendar on my main root window, the calendar appear just fine. So, i decided to put another but
Author of this widget used one unnecessary action: this widget set minimal size of root window, and he assumed that it is the only window in a program (it isn't bug, it's feature).
1.In method def __place_widgets(self)
:
self._calendar = ttk.Treeview(show='', selectmode='none', height=7)
should be:
self._calendar = ttk.Treeview(self, show='', selectmode='none', height=7)
2.In constructor remove line:
self._calendar.bind('<Map>', self.__minsize)
3.Delete __minsize
method
4.If you want to set minimal size for root2
use this code:
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())