if len(argv) < 2: print('You must specify a name argument.') else: config = Config().get() capture = Capture(config) trans = Transform(config) display = Display() detect = Detect() label = Label() with capture, display: key = '' while key != 'q': success = False image = capture.frame() disk = trans.image_copy(image) disk = trans.image_color_flip(disk) small = trans.scale_image(image) locs = detect.locations(small) if len(locs) == 1: success = True loc = trans.scale_location(locs[0]) label.set_image(image).set_location(loc) image = label.outline().header(argv[1]).get_image() display.show(image) key = display.key() if key == 'c' and success == True: print('Capturing {}...'.format(argv[1])) Save().image(disk, argv[1])
if __name__ == '__main__': # 添加oracle client驱动环境变量(添加到首位,避免与已存在client冲突) os.environ['PATH'] = os.path.join( os.path.dirname(os.path.realpath(sys.argv[0])), 'instantclient_19_3\\') + ';' if os.getenv('TNS_ADMIN'): del os.environ['TNS_ADMIN'] os.environ[ 'NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.AL32UTF8' # client使用utf-8编码 # 高DPI QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True) # enable highdpi scaling QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True) # use highdpi icons app = QApplication(sys.argv) # 加载QT 官方翻译 translator = QtCore.QTranslator() translator.load("res/qt_zh_CN.qm") QApplication.installTranslator(translator) ui = mainUI.Ui_MainWindow() # 可以理解成将创建的 ui 绑定到新建的 mainWnd 上 display = Display(ui) display.show() sys.exit(app.exec_())