self state('normal'elif sys platform[: ='win'self state('zoomed'self saveimage imgpil self savephoto imgtk trace((scrwidescrhigh)imgpil sizetoo big for displaynowin size per img do windows fullscreen others use geometry(keep reference on me def sizetodisplayside(selfscaler)resize to fill one side of the display imgpil self saveimage scrwidescrhigh self maxsize(wm screen size , imgwideimghigh imgpil size img size in pixels newwidenewhigh scaler(scrwidescrhighimgwideimghighif (newwide newhigh imgwide imghigh)filter image antialias shrinkantialias elsegrowbicub sharper filter image bicubic imgnew imgpil resize((newwidenewhigh)filterself drawimage(imgnewdef onsizetodisplayheight(selfevent)def scalehigh(scrwidescrhighimgwideimghigh)newhigh scrhigh newwide int(scrhigh (imgwide imghigh)return (newwidenewhighself sizetodisplayside(scalehighdef onsizetodisplaywidth(selfevent)def scalewide(scrwidescrhighimgwideimghigh)newwide scrwide newhigh int(scrwide (imghigh imgwide)return (newwidenewhighself sizetodisplayside(scalewide true div proportional true div def zoom(selffactor)zoom in or out in increments imgpil self saveimage widehigh imgpil size if factor antialias best if shrink filter image antialias also nearestbilinear elsefilter image bicubic new imgpil resize((int(wide factor)int(high factor))filterself drawimage(newdef onzoomin(selfeventincr )self zoom( incrdef onzoomout(selfeventdecr )self zoom( decrdef onsaveimage(selfevent)save current image state to file filename savedialog show(pyphotoan image viewer and resizer