diff --git a/main.py b/main.py index e19a0888..161d9da0 100644 --- a/main.py +++ b/main.py @@ -7,8 +7,13 @@ # #------------------------------------------------------------------------------- from __future__ import division -from Tkinter import * -import tkMessageBox +try: + import tkinter + import tkinter.messagebox +except: + import Tkinter as tkinter + import tkMessageBox +from tkinter import * from PIL import Image, ImageTk import os import glob @@ -133,7 +138,7 @@ def loadDir(self, dbg = False): self.imageDir = os.path.join(r'./Images', '%03d' %(self.category)) self.imageList = glob.glob(os.path.join(self.imageDir, '*.JPEG')) if len(self.imageList) == 0: - print 'No .JPEG images found in the specified dir!' + print ('No .JPEG images found in the specified dir!') return # default to the 1st image in the collection @@ -164,7 +169,7 @@ def loadDir(self, dbg = False): self.egLabels[i].config(image = self.egList[-1], width = SIZE[0], height = SIZE[1]) self.loadImage() - print '%d images loaded from %s' %(self.total, s) + print ('%d images loaded from %s' %(self.total, s)) def loadImage(self): # load image @@ -203,7 +208,7 @@ def saveImage(self): f.write('%d\n' %len(self.bboxList)) for bbox in self.bboxList: f.write(' '.join(map(str, bbox)) + '\n') - print 'Image No. %d saved' %(self.cur) + print ('Image No. %d saved' %(self.cur)) def mouseClick(self, event):