self lastsec sec ampm ((hour > and 'pm'or 'am hour (hour or self display onupdate(hourminsecampmself cfgself datelabel config(text=time ctime(secssinceepoch)self countdownseconds - if self countdownseconds = self oncountdownexpire(countdown timer self after( /checkspersecself ontimerrun times per second /trunc int div def oncountdownsec(selfevent)secs askinteger('countdown''seconds?'if secsself countdownseconds secs def oncountdownmin(selfevent)secs askinteger('countdown''minutes'if secsself countdownseconds secs def oncountdownexpire(self)caveatonly one activeno progress indicator win toplevel(msg button(wintext='timer expired!'command=win destroymsg config(font=('courier' 'normal')fg='white'bg='navy'msg config(padx= pady= msg pack(expand=yesfill=bothwin lift(raise above siblings if sys platform[: ='win'full screen on windows win state('zoomed'##############################################################################standalone clocks ##############################################################################appname 'pyclock use new custom tktoplevel for iconsetc from pp gui tools windows import popupwindowmainwindow class clockpopup(popupwindow)def __init__(selfconfig=clockconfigname='')popupwindow __init__(selfappnamenameclock clock(configselfclock pack(expand=yesfill=bothclass clockmain(mainwindow)def __init__(selfconfig=clockconfigname='')mainwindow __init__(selfappnamenameclock clock(configselfclock pack(expand=yesfill=bothb/ compatmanual window borderspassed-in parent pyclockan analog/digital clock widget