[wxPython-users] Re: wx.Locale mystery

Cody Precord codyprecord at gmail.com
Thu Dec 20 04:35:00 PST 2007


Hello,

On Dec 20, 2007, at 6:07 AM, Donn Ingle wrote:

>> I do something like the following,
> I have just tried a 'mixture' of the two like that and it's still  
> confusing.
>
> If I mix the two and then remove the line:
> _ = wx.GetTranslation
> The app now responds to print _("stuff") but the stock buttons are  
> still all
> in English.
>  I don't think the wx.Locale stuff is doing anything at all - the  
> gettext
> stuff is just working via _
>
>
>> Also be sure that the wxLocale object remains alive during the
>> runtime of your program.
> How could I check? And what kills it?
>

By stays alive I meant it should be kept somewhere where it doesn't  
get cleaned up (i.e created as a temporary object in function call  
somewhere) until the program is finished.

I usually create the Locale object inside of a main method:

def Main():
	app = wx.App()
	mylocale = wx.Locale(xxxx)
	...
	app.MainLoop()

if __name__ == '__main__':
	Main()

The 'Main' function doesn't return until the MainLoop is finished so  
the 'mylocale' object doesn't get deleted until the program exits.

> \d
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users- 
> help at lists.wxwidgets.org
>

Regards,

Cody Precord




More information about the wxpython-users mailing list