[issue18131] Tkinter Variables require a proper master

2020-12-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

And the first issue was fixed in issue42630.

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18131] Tkinter Variables require a proper master

2019-04-26 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18131] Tkinter Variables require a proper master

2014-10-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> 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?

Technically all works (raises some exception), but I agree that error message 
can be more friendly. But _default_root is implementation detail. This name 
doesn't mean anything for non-experienced user (and experienced user already 
knows about these mystical RuntimeError and NameError). The message should say 
something like "No default root window" if _default_root is None and "The 
master argument is mandatory after calling NoDefautRoot()" if _default_root 
isn't set.

And now we came to the way how to create default root window. Issue4343 looks 
related (I haven't looked at it close however).

Second issue was fixed in issue22068.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18131] Tkinter Variables require a proper master

2014-10-04 Thread Terry J. Reedy

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18131] Tkinter Variables require a proper master

2014-10-04 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18131] Tkinter Variables require a proper master

2014-10-03 Thread Mark Lawrence

Mark Lawrence added the comment:

Just a gentle reminder.

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18131] Tkinter Variables require a proper master

2013-06-03 Thread Terry J. Reedy

New submission from Terry J. Reedy:

The signature for tkinter class Variable and its subclasses StringVar, IntVar, 
DoubleVar, BooleanVar is
  def __init__(self, master=None, value=None, name=None):
However, the None default is invalid because of
self._tk = master.tk
The preceding lines
if not master:
master = _default_root
might suggest that None is acceptible. But _default_root is set to None at the 
top of the file, so that just replaces None with None.

If Variables must have a gui widget parent, then they cannot be used in 
gui-free tests, even though they have no graphic representation.

Moveover, not everything is a proper master. configSectionNameDialog.py . 
GetCfgSectionNameDialog(Toplevel) . Create.Widgets(self) has these lines:
self.name = StringVar(self)
self.fontSize = StringVar(self)
However, these are not (always) garbage collectable.

After fixing the dialog test at the bottom of the file, and running it with 3.3 
python_d -m idlelib.configSectionNameDialog (#18130), and adding the gc flag, I 
repeatedly got
[sys:1: ResourceWarning: gc: 2 uncollectable objects at shutdown 
[, 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com