Terry J. Reedy added the comment:
My first message discussed two different issues. The first, generalized, is
that unconditionally using tkinter._default_root, which can be either None or
absent, as a backup for master=None in __init__ functions, seems a bit sloppy.
Image.__init__ does this check
if not master:
master = _default_root
if not master:
raise RuntimeError('Too early to create image')
but that will fail if _default_root has been deleted. Also, the message is
wrong in that it is not 'too early' if an explicit master is passed. I am
thinking that all uses of _default_root should raise something like
WhateverError("An explicit master is required when _default_root is None or
deleted.") Serhiy, what do you think?
The second issue noted that while widgets often have a container widget as
master, the non-graphics classes like Variable and Font should have a Tk and
not a widget as master. I have corrected idlelib.configHandler and there is a
tkinter patch on another issue (applied yet?) to automatically replace
master=widget by master-widget.tk. So Variable calls are no longer part of
this issue.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18131>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com