[Tutor] thinter: can't figure out how to update a window instead of creating a new on

Alan Gauld alan.gauld at yahoo.co.uk
Sun Jan 28 08:01:59 EST 2018


On 28/01/18 02:58, Chris Roy-Smith wrote:

> I have been playing around with the following code which I want to 
> update the window, but I creates a new window

Yes, you are creating a new window each time.
You really need to have a separate unction create the
window once and store it (or the widgets of interest)
in a variable somewhere.

Then your other functions can simply update the widgets
through the variable(s)

Remember that anything you create inside a function
gets thrown away as soon as the function exits. To make
it persist you need to move it into global storage
(or start using objects, but thats a whole other discussion)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list