from tkinter import from pil import imagetk photoimg imagetk photoimage(file=imgdir "spam jpg"button(image=photoimgpack(or with the more verbose equivalentwhich comes in handy if you will perform image processing in addition to image displayfrom tkinter import from pil import imageimagetk imageobj image open(imgdir "spam jpeg"photoimg imagetk photoimage(imageobjbutton(image=photoimgpack(in factto use pil for image displayall you really need to do is install it and add single from statement to your code to get its replacement photoimage object after loading the original from tkinter the rest of your code remains unchanged but will be able to display jpegpngand other image typesfrom tkinter import from pil imagetk import photoimage imgobj photoimage(file=imgdir "spam png"button(image=imgobjpack(<=add this line pil installation details vary per platformon windowsit is just matter of downloading and running self-installer pil code winds up in the python install directory' lib\site-packagesbecause this is automatically added to the module import search pathno path configuration is required to use pil simply run the installer and import the pil package' modules on other platformsyou might untar or unzip fetched source code archive and add pil directories to the front of your pythonpath settingsee the pil system' website for more details (in facti am using pre-release version of pil for python in this editionit should be officially released by the time you read these words there is much more to pil than we have space to cover here for instanceit also provides image conversionresizingand transformation toolssome of which can be run as command-line programs that have nothing to do with guis directly especially for tkinter-based programs that display or process imagespil will likely become standard component in your software tool set see documentation sets to help get you startedthoughwe'll close out this with handful of real scripts that use pil for image display and processing tkinter tourpart