How to change menu text with Tkinter?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Sep 27 09:59:05 EDT 2006


In <1159363771.905537.224780 at d34g2000cwd.googlegroups.com>, Phil Schmidt
wrote:

> I am making a little Tkinter GUI app that needs to be in several
> languages (english, french, etc.), adjustable at runtime via a menu
> pick to select the language. The only way I can see to change text in
> the menus entries is to destroy them and recreate them usiing different
> labels. This seems very clunky though, and there must be a better way.
> Can anyone offer any pointers or a short example for how to do this?

Do you really need this at runtime or is it enough to store the language
in a config file and ask the user to restart the application?  Then using
the `gettext` module is a good way.  Maybe in combination with the
`locale` module so you can use the language of the operating system as
default if the user doesn't choose one explicitly.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list