[Tutor] Tkinter and after() method

Alan Gauld alan.gauld at yahoo.co.uk
Wed Feb 1 12:29:43 EST 2023


On 01/02/2023 02:39, Cameron Simpson wrote:

>>>> my_dial = None    # I cannot see an alternative to their use at the 
>>>> moment
>>>> my_canvas = None
>>> Why not make them attributes of your root class?
> 
> This ties Phil back to a single dial. And also ties the dial to the 
> widget kit (tkinter).

It's a single value wherever it sits.
Thats easy to fix: just change it to

my_dials = []

And add the dials as they are created.

As for the widget kit, unless he's going to get very
fancy and start using MVC patterns etc I think that's
a done deal!

-- 
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