This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients rhettinger, serhiy.storchaka, terry.reedy
Date 2016-06-02.21:44:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464903859.31.0.66808302891.issue27025@psf.upfronthosting.co.za>
In-reply-to
Content
While a widget tree could be constructed using tk's introspection functions, I believe there are other good uses for monkey patching.  The attached .py file defines a monkeypatch context manager (does one exist already?).  The file uses the c.m. twice to patch ConfigDialog.CreatePageFontTab so it patches tk for the duration of its call.  The result is 16 rather than 287 lines of output.

>Current (from my program)
>.3070117292.3069168812.3069169068.3069251628.3068822220.3069266540.3068822348.3068839820.3068851532
> Using Tk command name as a base of a name: >._toplevel1._frame1._frame2._frame73._labelframe10._frame127._canvas6._frame128._label28
>Using Python class name:
>._configdialog1._tabbedpageset1._frame1._frame61._labelframe10._verticalscrolledframe6._canvas6._frame105._label28

In the future, the last line might be shortened to
>._config1._notebook1._frame1._frame61._labelframe10._vscrollframe6._canvas6._frame105._label28
which is shorter that the current address-based name. Anyone who cares can either user shorted class names or explicitly gives instances shorter default names.

I don't know what to say about numbering, except that I would prefer any of the options to status quo.
History
Date User Action Args
2016-06-02 21:44:19terry.reedysetrecipients: + terry.reedy, rhettinger, serhiy.storchaka
2016-06-02 21:44:19terry.reedysetmessageid: <1464903859.31.0.66808302891.issue27025@psf.upfronthosting.co.za>
2016-06-02 21:44:19terry.reedylinkissue27025 messages
2016-06-02 21:44:19terry.reedycreate