Tkinter: runtime widget naming?

Fredrik Lundh fredrik at pythonware.com
Thu May 24 15:03:32 EDT 2001


sternber at socrates.Berkeley.EDU wrote:
> I'm translating a Tk system that does alot of this:
>
>   set b ".mybutton"
>   ...
>   button $b ...
>
> What is a good way to do this in Python?  There is, of course,
>
>   b = "mybutton"
>   ...
>   exec( b + "= Button(...)" )
>
> Is there a better way?

see:
http://www.pythonware.com/library/tkinter/introduction/x147-more-on-widget-names.htm

Cheers /F





More information about the Python-list mailing list