def quit(msg=""): print "USAGE: python %s mypicture.tif\n Error: %s.\n" % (sys.argv[0], msg) sys.exit() try: filename = sys.argv[1] except: quit("missing filename") basename, ext = os.path.splitext(filename) if ext == "": quit("Filename has no extension") s1, s2 = vck.splitImage(filename, basename + "_1" + ext, basename + "_2" + ext) def display(root, share1=s1, share2=s2): # The function you pass to mainApp, which takes care of all the Tkinter # black magic, must take "root" (Tk's root window) as a parameter. It # must also return a tuple with all the windows it created. window1 = share1.view(root) window2 = share2.view(root) result = vck.OR(share1, share2) windowResult = result.view(root) return window1, window2, windowResult vck.mainApp(display)
def quit(msg=""): print("USAGE: python {} mypicture.tif\n Error: {}.\n".format( sys.argv[0], msg)) sys.exit() try: filename = sys.argv[1] except: quit("missing filename") basename, ext = os.path.splitext(filename) if ext == "": quit("Filename has no extension") def doit(root, image=filename, base=basename): # The function you pass to mainApp, which takes care of all the Tkinter # black magic, must take "root" (Tk's root window) as a parameter. It # must also return a tuple with all the windows it created. s1, s2, w1, w2 = vck.splitImageG(root, filename, base + "_1.ps", base + "_2.ps") wBoth = s1.view(root) s2.renderOnCanvas(wBoth.canvas()) return w1, w2, wBoth vck.mainApp(doit)
import sys import os def quit(msg=""): print "USAGE: python %s mypicture.tif\n Error: %s.\n" % (sys.argv[0], msg) sys.exit() try: filename = sys.argv[1] except: quit("missing filename") basename, ext = os.path.splitext(filename) if ext == "": quit("Filename has no extension") def doit(root, image=filename, base=basename): # The function you pass to mainApp, which takes care of all the Tkinter # black magic, must take "root" (Tk's root window) as a parameter. It # must also return a tuple with all the windows it created. s1, s2, w1, w2 = vck.splitImageG( root, filename, base + "_1.ps", base + "_2.ps") wBoth = s1.view(root) s2.renderOnCanvas(wBoth.canvas()) return w1, w2, wBoth vck.mainApp(doit)