On Fri, 26 Feb 2016 22:49:58 +0100, Peter Otten wrote: > Wildman via Python-list wrote:
> It's not you, the program as you wrote it should and would show the image, > were it not for an odd quirk in how images are handled in tkinter: > > You have to keep an explicit reference of the Image to prevent it from being > garbage-collected. Changing open_image() as follows > >> def open_image(self): >> file_filter = [ >> ('X BitMap', '*.xbm *.XBM'), >> ('all files', '*.*') >> ] >> fileName = tkFileDialog.askopenfilename(parent=root, >> initialdir=cv.default_dir, >> filetypes=file_filter, >> title="Open XBM Image") >> if fileName: >> cv.default_dir = os.path.dirname(fileName) >> openImage = Image.open(fileName) > self.imageFile = ImageTk.BitmapImage(openImage) > self.xbmImage.config(image=self.imageFile) >> else: >> return None > > should achieve that. You, Sir, are a scholar and a gentleman. Your change worked perfectly. A thousand thank-you's. -- <Wildman> GNU/Linux user #557453 "Be at war with your vices, at peace with your neighbors, and let every new year find you a better man." -Benjamin Franklin -- https://mail.python.org/mailman/listinfo/python-list