self image photoimage(file=cfg picturebkground exceptself image bitmapimage(file=cfg picturesave ref imgx (cfg size self image width()/ center it imgy (cfg size self image height()/ /div self create_image(imgx+ imgy+ anchor=nwimage=self imageoriginx originy radius cfg size / /div for in range( )xy self point( radius- originxoriginyself create_rectangle( - - + + fill=cfg fgmins for in range( )xy self point( radius- originxoriginyself create_rectangle( - - + + fill=cfg fghours self ampm self create_text( anchor=nwfill=cfg fgdef point(selftickunitsradiusoriginxoriginy)angle tick ( unitsradiansperdegree math pi pointx introundradius math sin(angle radiansperdegree)pointy introundradius math cos(angle radiansperdegree)return (pointx originx+ )(originy+ pointydef onupdate(selfhourminssecsampmcfg)on timer callback if self cogredraw handscog self delete(self cogself delete(self hourhandself delete(self minshandself delete(self secshandoriginx originy radius cfg size / div hour hour (mins hxhy self point(hour (radius )originxoriginymxmy self point(mins (radius )originxoriginysxsy self point(secs (radius )originxoriginyself hourhand self create_line(originxoriginyhxhywidth=(cfg size )arrow='last'arrowshape=( , , )fill=cfg hhself minshand self create_line(originxoriginymxmywidth=(cfg size )arrow='last'arrowshape=( , , )fill=cfg mhself secshand self create_line(originxoriginysxsywidth= arrow='last'arrowshape=( , , )fill=cfg shcogsz cfg size self cog self create_oval(originx-cogszoriginy+cogszoriginx+cogszoriginy-cogszfill=cfg cogself dchars(self ampm endself insert(self ampmendampmdef onresize(selfnewwidthnewheightcfg)newsize min(newwidthnewheight#print('analog onresize'cfg size+ newsizeif newsize !cfg size+ cfg size newsize- self delete('all'pyclockan analog/digital clock widget