[Tutor] Dynamic TKinter widgets?

ALAN GAULD alan.gauld at btinternet.com
Wed Nov 28 23:17:51 CET 2012


Then I remembered that all I need to do to create a widget is simply call it and add it to the layout, so I just created a single Frame and a loop that adds a variable number of widgets. Now I just destroy that Frame (and thus, the widgets it holds), recreate it, and repopulate it. 
>Which, re-reading this discussion, is probably what you meant by standard practice. 
>
>Exactly so, you create the widgets you need, then throw them away when done. 
You store them in a container for the duration. So long as their associated methods 
are connected to your core data then you can use them and dispose of them.


>>> Don't get hung up on the number of widgets. In the scheme of things widgets are not 
>>> expensive. Create them as you need them, delete them when you are done. Layout 
>>> managers are there to manage the layout for you. 
>>
>>
>>> Alan G.
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121128/8f29e01a/attachment.html>


More information about the Tutor mailing list