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 ned.deily
Recipients asvetlov, loewis, ned.deily, serhiy.storchaka, takluyver, terry.reedy
Date 2012-05-14.00:40:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336956022.69.0.328504373443.issue14777@psf.upfronthosting.co.za>
In-reply-to
Content
Serhiy, I don't know why Misc.Tk is not module level but it isn't so caching global attributes there isn't effective.  However, upon further consideration, I take back my original suggestion of caching at the module level primarily because I can think of future scenarios where it might be possible that there are different windowing systems supported in the same Python instance.  I now think the best solution is to cache at the Tk root object level; that appears to be a simple change to Thomas's 2nd revision.  Sorry about that!  Here is a fourth version (one for 3.x and one for 2.7) based on the second which includes the fix from the 3rd.

I started to write a simple test for the clipboard functions but then realized that there doesn't seem to be a practical way to effectively test in a machine-independent way without destroying the contents of the Tk clipboard and hence the user's desktop clipboard, not a friendly thing to do.  For example, the clipboard might contain a data type not supported by the platform's Tk, like pict data on OS X.  So I'm not including the test here but it did verify that the attribute was being properly cached across multiple tkinter objects.

Thanks to Thomas for the patch and to Serhiy for reviewing.  By the way, Thomas, for your patch to be included, you should submit a PSF contributor agreement as described here:  http://www.python.org/psf/contrib/.  Once that is in place and if the patch looks good to everyone, I'll apply it.
History
Date User Action Args
2012-05-14 00:40:22ned.deilysetrecipients: + ned.deily, loewis, terry.reedy, asvetlov, takluyver, serhiy.storchaka
2012-05-14 00:40:22ned.deilysetmessageid: <1336956022.69.0.328504373443.issue14777@psf.upfronthosting.co.za>
2012-05-14 00:40:22ned.deilylinkissue14777 messages
2012-05-14 00:40:21ned.deilycreate