def DetectPeople(cfgPath): print "hi" cam = Camera(cfgPath) app = QtWidgets.QApplication([]) window = GUI(cfgPath) window.setCamera(cam) window.show() # Threading camera t_cam = ThreadCamera(cam) t_cam.start() # Threading GUI t_gui = ThreadGUI(window) t_gui.start() sys.exit(app.exec_())
def play_game(self): self.start_ais() if self.activate_gui: gui = GUI(self.block_size, self.height, self.width, [ai.name for ai in self.AIs]) gui.update_screen(self.state) while not self.state.game_over: move = self.pick_move() piece_num, piece, anchor = move self.commit_move(piece_num, piece, anchor) if self.activate_gui: # update gui gui.update_screen(self.state) elif self.activate_terminal: print(self.state) # gui game end print("Game_Over") print(self.state.scores) print("Player " + str(np.argmax(self.state.scores) + 1) + " has won!\n") # while 1: # continue return np.argmax(self.state.scores) + 1
tracker_prop, tracker_lib_prop = selectTracker(cfg) logger_status = readLoggerStatus(cfg) network = DetectionNetwork(net_prop) # Threading Network t_network = ThreadNetwork(network) t_network.setDaemon(True) # setting daemon thread to exit t_network.start() tracker = Tracker(tracker_prop, tracker_lib_prop) # Threading Tracker t_tracker = ThreadTracker(tracker) t_tracker.setDaemon(True) t_tracker.start() window = GUI() cam.setGUI(window) cam.setLogger(logger_status) cam.setNetwork(network, t_network) cam.setTracker(tracker) cam.setNetworkParams(image_net_size, confidence) # Threading camera t_cam = ThreadCamera(cam) t_cam.setDaemon(True) t_cam.start() window.setNetwork(network, t_network) window.setTracker(tracker) if gui_cfg == 'on': window.show()
from GUI.gui import GUI from GUI import callbacks from GUI.app import app from dash.dependencies import Output, Input, State ## create the GUI gui = GUI() ## ugly part..., for rendering the tab content, ## because there is no other part can get layout instant, ## so put this callback func here### @app.callback([Output('pages_content', 'children')], [Input('tabs', 'value')]) def renderContent(tab): if tab == 'tab1': return gui.layout.tabOne, else: return gui.layout.tabTwo, if __name__ == '__main__': gui.app.run_server(host='0.0.0.0', debug=False)
for image in images: crop(image, page_area, image) page_size = define_page_size(images[0]) page_area_in_pt = px_to_pt(page_size) page_area_in_pt = page_area_in_pt[0] - 100, page_area_in_pt[1] - 100 print(page_area_in_pt) create_pdf_from_images(images, page_area_in_pt, output_dir=pdf_output_dir, output_file=pdf_name) except Exception as e: print(e) print("finish") if __name__ == '__main__': import sys app = QApplication(sys.argv) main_window = QMainWindow() ui = GUI(main_window) ui.add_logic() ui.set_downloader(download_book) sys.exit(app.exec_())
import argparse import sys from GUI.gui import GUI from console.console import Console cons = Console() def createParser(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--insert') parser.add_argument('-v', '--view') return parser if __name__ == '__main__': parser = createParser() namespace = parser.parse_args(sys.argv[1:]) if namespace.insert != None: cons.get(str(namespace.insert)) elif namespace.view != None: print(cons.view()) else: GUI().wind()
return object if __name__ == "__main__": # Init objects app = QtWidgets.QApplication(sys.argv) data = readConfig() cam, cam_depth = selectVideoSource(data) viz3d = None if cam_depth: viz3d = init_viz() window = GUI3D(cam, cam_depth) else: window = GUI(cam) window.show() estimator = Estimator(cam, cam_depth, viz3d, window, data["Estimator"]) # Threading camera t_cam = ThreadCamera(cam) t_cam.setDaemon(True) t_cam.start() t_cam_depth = ThreadCamera(cam_depth) t_cam_depth.setDaemon(True) t_cam_depth.start() # Threading estimator t_estimator = ThreadEstimator(estimator) t_estimator.setDaemon(True)
else: raise SystemExit( ('%s not supported! Supported frameworks: Keras, TensorFlow') % (network_framework)) cam = Camera(proxy) t_cam = ThreadCamera(cam) t_cam.start() network = Network(network_model_path) network.setCamera(cam) t_network = ThreadNetwork(network) t_network.start() app = QtWidgets.QApplication(sys.argv) window = GUI(framework_title) window.setCamera(cam, t_cam) window.setNetwork(network, t_network) window.show() # Threading GUI t_gui = ThreadGUI(window) t_gui.start() print("") print("Framework used: %s" % (framework_title)) print("Requested timers:") print(" Camera: %d ms" % (t_cam.t_cycle)) print(" GUI: %d ms" % (t_gui.t_cycle)) print(" Network: %d ms" % (t_network.t_cycle)) print("")