Reputation: 31
I've been working on a GUI, and one command I need to execute is ngrok.exe. But whenever I use os.system(f"ngrok.exe http --basic-auth {base_creds} file:///Mal_Files")
it freezes the GUI and wont continue working. Is there any way to fix this? I've heard threads could help but i dont know anything about them.
CODE
def start_ngrok():
ngrok_creds = open("tools/ngrok_creds.txt", "r")
ngrok_creds_lines = ngrok_creds.readlines()
base_creds = ngrok_creds_lines[0]
ngrok_creds.close()
try:
os.system(f"ngrok.exe http --basic-auth {base_creds} file:///Mal_Files")
ngrok_started_q = True
except:
print("Error staring ngrok server, try again later.")
ngrok_started_q = False
os.kill
# Button to start ngrok code
run_ngrok = tkinter.Button(base_frame, text="Start Ngrok",command=Main.start_ngrok, width=20)
base_frame.create_window(80, 20, window=run_ngrok)
Upvotes: 0
Views: 64