continue conn = socket.socket() utils.set_keepalive(conn) try: conn.connect((ip, HOST_PORT)) conn = ssl.wrap_socket( sock=conn, certfile=CERT_FILE, keyfile=PRIVATE_KEY_FILE, server_side=True) hosts[ip] = conn update_hosts(utils.Event(hosts=hosts.keys())) except: conn.close() BDlistener.close() if __name__ == "__main__": CERT_FILE = utils.resource_path("cert.pem") PRIVATE_KEY_FILE = utils.resource_path("key.pem") THREADS = 32 private_key = RSA.import_key(open(PRIVATE_KEY_FILE).read()) cipher_rsa = PKCS1_OAEP.new(private_key) hosts = {} pool = ThreadPool(processes=THREADS) app = Application(fetch_file) Thread(target=fetch_files, args=(app.on_file_fetched, app.get_interval, app.update_hosts), daemon=True).start() Thread(target=listen_to_hosts, args=( app.update_hosts,), daemon=True).start() app.mainloop()
def main(): root = tk.Tk() root.bind("<Key>", keypress) root.bind("<Button-1>", mouseclick) app = Application(master=root) app.mainloop()