Start New Discussion within our Software Development Community

PySide (public license PyQT) is my preferred Python GUI toolkit. Here we explore how to test some of the widgets available and create a digital clock.

a simple template to test a PySide widget like QLCDNumber()
for Python33 I used the Windows self-extracting installer

tested by  vegaseat  04oct12

import time
from PySide.QtCore import *
from PySide.QtGui import *

app = QApplication([])  # no need to import sys

# ----- start your widget test code ----

def tick():
    # get the current local time in hh:mm:ss format
    currtime = time.strftime('%H:%M:%S')

lcd = QLCDNumber()

# use style sheet to set background color
# color is a string in #RRGGBB format
blue = "#0000ff"
style_str = "QWidget {background-color: %s}"
lcd.setStyleSheet(style_str % blue)

# call tick() every second to update clock display
timer = QTimer()

# ---- end of widget test code -----

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.