[Tutor] Tkinter and after() method

Phil phillor9 at gmail.com
Wed Feb 1 19:34:07 EST 2023


On 2/2/23 03:45, Alan Gauld via Tutor wrote:
>
> class TkDial(Dial):
>     # Tkinter version of a dial
>
> class WxDial(Dial):
>     # wxPython version of a dial
>
Thank you Cameron and Alan for your advice.

I spent around four hours on this yesterday afternoon and ended up with 
two dials of different sizes sweeping their pointers at different time 
intervals and without any global variables.

I solved this by moving all of the calculation routines to the dial 
class. To overcome the problem of dealing with Tkinter and Wxpython I 
created  two dial classes (two separate files). The Tkinter version 
handles the drawing routines and so the root class is very simple to 
use. The other version passes the result of its calculations to the root 
class leaving the root class to handle the drawing tasks. This is overly 
complex and requires the user, me, to have intimate knowledge of the 
data passed from the dial class. By next week this user will have 
forgotten what the huge amount of data mean.

I couldn't think of a way to import the required class and because of 
the growing complexity I gave this idea away. Wxpython has its own dial 
widget anyway. It didn't occur to me to have two classes that differed 
only by their drawing routines.

Anyway, thank you again for you persistence.

-- 

Regards,
Phil



More information about the Tutor mailing list