Aug-09-2021, 05:58 PM
(This post was last modified: Aug-09-2021, 05:58 PM by deanhystad.)
Your DateEntry will not appear in root window.
It is likely that your program is crashing trying to add the datetime widget, but tkinter catches a lot of exceptions and tries to muddle on. If you move the code creating the datetime widget further down in you program you will see more widgets in your form. This is a debugging trick, not a fix. If you can see all the widgets added before DateEntry and none added after, it is likely the problem is with adding DateEntry.
class MyDateEntry(DateEntry): def __init__(self, master=None, **kw): DateEntry.__init__(self, master=None, **kw) # Overrides whatever is passed as "master". Call without =NoneAnd what is _top_cal?
class MyDateEntry(DateEntry): def __init__(self, master=None, **kw): DateEntry.__init__(self, master=None, **kw) # add black border around drop-down calendar self._top_cal.configure(bg='black', bd=1) # What? # add label displaying today's date below tk.Label(self._top_cal, bg='gray90', anchor='w', text='Today: %s' % date.today().strftime('%x')).pack(fill='x')I looked up the source and found that _top_cal is a Toplevel window. This is not mentioned in the documentation and the leading underscore in _top_cal infers that this is supposed to be a private attribute. Unless you really, really need a black background and 1 pixel border, I would remove references to things that are not in the API.
It is likely that your program is crashing trying to add the datetime widget, but tkinter catches a lot of exceptions and tries to muddle on. If you move the code creating the datetime widget further down in you program you will see more widgets in your form. This is a debugging trick, not a fix. If you can see all the widgets added before DateEntry and none added after, it is likely the problem is with adding DateEntry.