from argparse import ArgumentParser, Namespace from threading import Thread from src import config, gui, trader from src.data import compile_regex, log def setup_args() -> Namespace: parser = ArgumentParser(description='Poe Trader', epilog="And that's how you trade") parser.add_argument('-c', '--configfile', help='Path to the yaml config file.', default=r'config.yaml') return parser.parse_args() if __name__ == "__main__": args = setup_args() log.debug(f'Read config from "{args.configfile}"') conf = config.read_config(args.configfile) log.debug('Compiling regex') compile_regex(conf) app = gui.Gui() my_thread = Thread(target=trader.read_log, args=(conf['General']['log_file'], app)) log.debug(f'Starting reader thread for "{conf["General"]["log_file"]}"') my_thread.start() app.mainloop()