Python Forum
Simple wxpython digital clock
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple wxpython digital clock
#1
#! /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()
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply


Messages In This Thread
Simple wxpython digital clock - by menator01 - Feb-20-2021, 05:12 PM
RE: Simple wxpython digital clock - by Larz60+ - Feb-20-2021, 05:41 PM
RE: Simple wxpython digital clock - by menator01 - Feb-20-2021, 05:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Playing around with a clock's seconds in tkinter menator01 1 2,514 Feb-12-2022, 04:32 PM
Last Post: menator01
  My Attempt at an alarm clock menator01 0 2,476 May-15-2020, 06:28 PM
Last Post: menator01
  Binary Clock sparkz_alot 13 14,110 Jan-02-2017, 03:52 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020