13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Internationalizationhttp://www.zetcode.com/wxpython/in18/For example, de_AT.utf8 is a german local used in Austria, withUTF8 codeset.#!/usr/bin/python# locale.pyimport wximport timeimport localeclass Locale(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title, size=(250, 420))panel = wx.Panel(self, -1)tm = time.localtime()font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)us = wx.StaticText(self, -1, 'United States', (25, 20))us.SetFont(font)wx.StaticLine(self, -1, (25, 50), (200 ,1))locale.setlocale(locale.LC_ALL, '')date = time.strftime('%x', tm)time_ = time.strftime('%X', tm)curr = locale.currency(100000)wx.StaticText(self, -1, 'date: ', (25, 70))wx.StaticText(self, -1, 'time: ', (25, 90))wx.StaticText(self, -1, 'currency: ', (25, 110))wx.StaticText(self, -1, str(date), (125, 70))wx.StaticText(self, -1, str(time_), (125, 90))wx.StaticText(self, -1, str(curr), (125, 110))de = wx.StaticText(self, -1, 'Germany', (25, 150))de.SetFont(font)wx.StaticLine(self, -1, (25, 180), (200,1))locale.setlocale(locale.LC_ALL, ('de_DE', 'UTF8'))date = time.strftime('%x', tm)time_ = time.strftime('%X', tm)curr = locale.currency(100000)wx.StaticText(self, -1, 'date: ', (25, 200))wx.StaticText(self, -1, 'time: ', (25, 220))wx.StaticText(self, -1, 'currency: ', (25, 240))wx.StaticText(self, -1, date, (125, 200))wx.StaticText(self, -1, time_, (125, 220))wx.StaticText(self, -1, curr, (125, 240))3 de 12 27/04/2008 1:06

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

Saved successfully!

Ooh no, something went wrong!