hbar scrollbar(containerorient='horizontal'vbar pack(side=rightfill=yhbar pack(side=bottomfill=xself pack(side=topfill=bothexpand=yespack canvas after bars so clipped first vbar config(command=self yviewhbar config(command=self xviewself config(yscrollcommand=vbar setself config(xscrollcommand=hbar setcall on scroll move call on canvas move class viewone(toplevel)""open single image in pop-up window when createda class because photoimage obj must be savedelse erased if reclaimedscroll if too big for displayon mouse clicksresizes to window' height or widthstretches or shrinkson / keypresszooms in/outboth resizing schemes maintain original aspect ratiocode is factored to avoid redundancy here as possible""def __init__(selfimgdirimgfileforcesize=())toplevel __init__(selfhelptxt '(click / or press / to resizes to saved to open)self title(appname imgfile helptxtimgpath os path join(imgdirimgfileimgpil image open(imgpathself canvas scrolledcanvas(selfself drawimage(imgpilforcesizeself canvas bind(''self onsizetodisplayheightself canvas bind(''self onsizetodisplaywidthself bind(''self onzoominself bind(''self onzoomoutself bind(''self onsaveimageself bind(''ondirectoryopenself focus(def drawimage(selfimgpilforcesize=())imgtk photoimage(image=imgpilscrwidescrhigh forcesize or self maxsize(imgwide imgtk width(imghigh imgtk height(fullsize ( imgwideimghighviewwide min(imgwidescrwideviewhigh min(imghighscrhighnot file=imgpath wm screen size , size in pixels same as imgpil size scrollable viewable canvas self canvas canvas delete('all'clear prior photo canvas config(height=viewhighwidth=viewwideviewable window size canvas config(scrollregion=fullsizescrollable area size canvas create_image( image=imgtkanchor=nw complete gui programs