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/self.dt = wx.DateTime()self.tokyo = wx.StaticText(self.panel, -1,self.dt.FormatTime() , (20, 20))self.tokyo.SetForegroundColour('#23f002')self.tokyo.SetFont(font)self.moscow = wx.StaticText(self.panel, -1,self.dt.FormatTime() , (20, 70))self.moscow.SetForegroundColour('#23f002')self.moscow.SetFont(font)self.budapest = wx.StaticText(self.panel, -1,self.dt.FormatTime() , (20, 120))self.budapest.SetForegroundColour('#23f002')self.budapest.SetFont(font)self.london = wx.StaticText(self.panel, -1,self.dt.FormatTime() , (20, 170))self.london.SetForegroundColour('#23f002')self.london.SetFont(font)self.newyork = wx.StaticText(self.panel, -1,self.dt.FormatTime() , (20, 220))self.newyork.SetForegroundColour('#23f002')self.newyork.SetFont(font)self.OnTimer(None)self.timer = wx.Timer(self)self.timer.Start(1000)self.Bind(wx.EVT_TIMER, self.OnTimer)self.Centre()self.Show(True)def OnTimer(self, evt):now = self.dt.Now()self.tokyo.SetLabel('Tokyo: ' + str(now.Format(('%a %T'),wx.DateTime.GMT_9)))self.moscow.SetLabel('Moscow: ' + str(now.Format(('%a %T'),wx.DateTime.MSD)))self.budapest.SetLabel('Budapest: ' + str(now.Format(('%a %T'),wx.DateTime.CEST)))self.london.SetLabel('London: ' + str(now.Format(('%a %T'),wx.DateTime.WEST)))self.newyork.SetLabel('New York: ' + str(now.Format(('%a %T'),wx.DateTime.EDT)))app = wx.App()WorldTime(None, -1, 'World Time')app.MainLoop()In the code example, we show current time in Tokyo, Moscow,Budapest, London and New York.6 de 12 27/04/2008 1:06

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

Saved successfully!

Ooh no, something went wrong!