Python Forum
unexplained issue with tkcalender module.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unexplained issue with tkcalender module.
#7
Your DateEntry will not appear in root window.
class MyDateEntry(DateEntry):
    def __init__(self, master=None, **kw):
        DateEntry.__init__(self, master=None, **kw)  # Overrides whatever is passed as "master".  Call without =None
And 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.
Reply


Messages In This Thread
RE: unexplained issue with tkcalender module. - by deanhystad - Aug-09-2021, 05:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Empty default value for tkCalender Tyrel 2 1,013 Aug-08-2023, 04:57 PM
Last Post: Tyrel
Lightbulb [Tkinter] Tkinter Class Import Module Issue AaronCatolico1 6 3,351 Sep-06-2022, 03:37 PM
Last Post: AaronCatolico1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020