[issue18131] Tkinter Variables require a proper master

Terry J. Reedy report at bugs.python.org
Sun Oct 5 03:36:49 CEST 2014


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 <report at bugs.python.org>
<http://bugs.python.org/issue18131>
_______________________________________


More information about the Python-bugs-list mailing list