Tkinter and option database

bakaikoa at my-deja.com bakaikoa at my-deja.com
Fri Jan 5 05:27:59 EST 2001


I cannot manage to use the option database in the way I used to do
with Tcl/Tk. In particular I do not see how to use the feature of
assigning options to named widgets. This was done in a simple way
in Tk by using the name of the widget at creation time. Tkinter is
automatically assigning a random name to each widget that is created.

Example:
in Tk
> option readfile greeting.res
>
> set message [ option get . greemsg Spanish ]
>
> set labtit  [ label .appTitle ]
> set labmsg  [ label .greetMsg -text $message ]

worked fine with file 'greeting.res':
> *appTitle.text: Saludo
> *greemsg:       hola

With Python/Tkinter I get the 'greemsg' all right but not the
application title:

> import Tkinter as Tk
>
> root = Tk.Tk()
>
> root.option_readfile('greeting.res')
>
> message = root.option_get('greemsg','French')
>
> labtit = Tk.Label()
> labmsg = Tk.Label(text=message)

Any hint, do you know of a way of assigning a Tk name
to a widget?

Thanks,

Bixente


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list