13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Internationalizationhttp://www.zetcode.com/wxpython/in18/de = wx.StaticText(self, -1, 'Slovakia', (25, 280))de.SetFont(font)wx.StaticLine(self, -1, (25, 310), (200,1))locale.setlocale(locale.LC_ALL, ('sk_SK', 'UTF8'))date = time.strftime('%x', tm)time_ = time.strftime('%X', tm)curr = locale.currency(100000)wx.StaticText(self, -1, 'date: ', (25, 330))wx.StaticText(self, -1, 'time: ', (25, 350))wx.StaticText(self, -1, 'currency: ', (25, 370))wx.StaticText(self, -1, str(date), (125, 330))wx.StaticText(self, -1, str(time_), (125, 350))wx.StaticText(self, -1, str(curr), (125, 370))self.Centre()self.Show(True)app = wx.App()Locale(None, -1, 'Locale')app.MainLoop()We use the standart built-in module locale to work withlocalized settings. In our example, we will show various formatsof date, time and currency in the USA, Germany and Slovakia.locale.setlocale(locale.LC_ALL, ('de_DE', 'UTF8'))Here we set a locale object for Germany. LC_ALL is acombination of all various local settings, e.g. LC_TIME,LC_MONETARY, LC_NUMERIC.date = time.strftime('%x', tm)time_ = time.strftime('%X', tm)curr = locale.currency(100000)<strong>The</strong>se function calls reflect the current locale object.4 de 12 27/04/2008 1:06

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!