def onRecognize(self): self.image = None if self.img_dir != '': model = Model(self.img_dir) recognize = Recognize(model) chars = recognize.recognize_all() chars = fix(self.img_dir[23], chars) for char in chars: self.text_frame.insert("end", char) else: messagebox.showwarning("Warning", "Please input image")
import math # Used as a decorator: x is initially 0 @fix(0) def x(f=math.cos): x = f(x) print x # Called directly, the initial value must be given as a keyword argument def x(): x = math.cos(x) print fix(x, init=0) # Self referential sentences, yay! from num2words import num2words @fix def sentence(): return "This sentence is %s characters long!" % num2words(len(sentence or "")) print (sentence) # Almost equivalent: @fix("")
import fix myFIX = fix.fix() file = open("I:\\20111026\\secdef.dat") outputFile = open("c:\\secdefout.txt", "w") i = 0 while file: message = file.readline() """ fields = myFIX.getFields(message) fields = myFIX.lookupFields(fields) for field in fields: outputFile.write(str(field) + '\n') outputFile.write('\n\n') #messageType = fix.getFixField(35, fields) """ i = i + 1 print(i) file.close() outputFile.close