Author terry.reedy
Recipients ezio.melotti, gpolo, serhiy.storchaka, terry.reedy
Date 2014-03-20.21:07:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1395349664.45.0.968252484837.issue20636@psf.upfronthosting.co.za>
In-reply-to
Content
After looking more at testing entire (Idle) dialogs and windows for sanity, I like the idea even more. A person can check that everything that is present looks ok, but code is at least as good as using a checklist to verify that what is present is exactly what should be present. For this, widgets should have meaningful and predictable names. Once widgets are given names, they should be used in the representation. The proposed

>>> top.winfo_children()
[<tkinter.Frame object .top.child]

is more helpful than the current

>>> top.winfo_children()
[<tkinter.Frame object at 0x000000000350BCF8>]


As for Ezio's question: The new method is defined in class tkinter.Misc and only applies to instances of subclasses thereof -- BaseWidget, Widget, etc, in tkinter.__init__ and ttk.Widget. I suppose other code might subclass something, but as far as I know, Idle classes 'have a' widget rather than 'being a' widget. But if Misc or a subclass could be sensibly subclassed in C code, you could, to be safe, change "top.__class__.__module__" to "getattr(top.__class__, '__module__', 'module'). I believe 'self._w' is safe as an object without ._w is not a tk widget.
History
Date User Action Args
2014-03-20 21:07:44terry.reedysetrecipients: + terry.reedy, gpolo, ezio.melotti, serhiy.storchaka
2014-03-20 21:07:44terry.reedysetmessageid: <1395349664.45.0.968252484837.issue20636@psf.upfronthosting.co.za>
2014-03-20 21:07:44terry.reedylinkissue20636 messages
2014-03-20 21:07:44terry.reedycreate