Simple wxpython digital clock - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: Code sharing (https://python-forum.io/forum-5.html) +--- Thread: Simple wxpython digital clock (/thread-32602.html) |
Simple wxpython digital clock - menator01 - Feb-20-2021 #! /usr/bin/env python3 import wx import time import wx.gizmos as gizmos def do_timer(event): cur = time.localtime(time.time()) fmt = time.strftime('%I:%M:%S', cur) led.SetValue(fmt) app = wx.App() window = wx.Frame(None, title='Digital Clock', size=(330,110), style=wx.DEFAULT_FRAME_STYLE) led = gizmos.LEDNumberCtrl(window, -1, wx.DefaultPosition, wx.DefaultSize, \ gizmos.LED_ALIGN_RIGHT) led.SetForegroundColour('red') timer = wx.Timer(window, -1) timer.Start(1000) window.Bind(wx.EVT_TIMER, do_timer) window.Show(True) app.MainLoop() RE: Simple wxpython digital clock - Larz60+ - Feb-20-2021 There's an analog clock in the wxpython demo if you're interested [attachment=1051] RE: Simple wxpython digital clock - menator01 - Feb-20-2021 Ok thanks |