[Tkinter]: tkMessageBox Internazionalization?
David LeBlanc
whisper at oz.nospamnet
Thu Jun 14 10:33:25 EDT 2001
In article <slrn9icnji.107.matt at happy-hour.mondoinfo.com>,
matt at mondoinfo.com says...
> On Tue, 12 Jun 2001 17:25:17 GMT, Nicola S. <stain at prigioniero.it>
> wrote:
>
> >Is there a comfortable way to change the text of the buttons in the
> >dialog window shown, for example, by tkMessageBox.askokcancel?
>
> >I'd like to use another language for the text 'OK' 'Cancel'; but
> >maybe this concerns tcl/tk internals.
>
> It seems that the text for those buttons is, as you suspect, buried in
> the sources. You might find it almost as easy to use the SimpleDialog
> module, which seems to be more flexible:
>
> >>> s=SimpleDialog.SimpleDialog(root,text="Continue?",
> ... buttons=("Yes","No"),default=0,cancel=1,title="test")
> >>> s.go()
> 1
>
> Regards,
> Matt
>
At least on Windows, there's no way to select other then which of the
buttons you do/do not want on the dialog - tkMessageBox is based on the
messagebox() win32 api function (which I think inspired it's
adaptation/emulation by Scriptics to other platforms). It allows you to
select from a predetermined palette of icons (error, warning,
information), which of the three (or four?) buttons you want up to the
maximum of three buttons you can have on the dialog, a caption and the
message you want to emit. Only the message text is mandatory, the rest
are defaulted for you.
The TkMessagebox (at least on Windows) *should* translate those button
texts to the locale of the user based on which language version of
Windows is being use - ymmv on X.
Regards,
Dave LeBlanc
More information about the Python-list
mailing list