Tkinter: "Get root for a widget" is private?

Randall Hopper aa8vb at
Wed Apr 5 13:35:26 CEST 2000

Fredrik Lundh:
 |Randall Hopper <aa8vb at> wrote:
 |> Given this it seems we should have a public root() method.  Could we
 |> add a:
 |>     root = _root
 |> definition to Tkinter's Misc class, to make this a public feature?
 |the question is why?
 |if you're only out to get an interpreter handle (e.g. to
 |instantiate a variable or image object), any widget will

I have a timer class built around Tk timers.  I realize I could just pass
any_old_widget into this routine, and it would store it off into state data
and use it periodically to access the 'after' and 'after_cancel' methods.

However, this timer has nothing to do with this widget in particular, so
why should it have a reference to it (versus the button next to it, or the
list widget below it)?  It makes more sense for the timer class to accept
and bookmark the root object.  This root is associated with the global Tk
state, and it makes sense for a timer to bookmark this to use global Tk
state commands.

Randall Hopper
aa8vb at

More information about the Python-list mailing list