Skip to content
Snippets Groups Projects
Commit f3c9d242 authored by drouver-helmuth's avatar drouver-helmuth
Browse files

use multithreading to start server

parent 67d221cf
Branches
Tags V0.6
No related merge requests found
import server
import subprocess as sb
from tkinter import *
from threading import Thread
def main():
server.threadServer.start()
thread1 = Thread(target=server.Server)
thread2 = Thread(target=server.Window)
thread1.start()
# server.Server()
window = Tk()
window.title("PZB 90")
window.configure(width=500, height=300)
window.configure(bg='lightgray')
window.mainloop()
return
......
......@@ -7,7 +7,7 @@ from threading import Thread
import subprocess as sb
def post_actions(data):
return "Success!"
return "200"
#class GetData:
# def __init__(self):
......@@ -42,10 +42,7 @@ def Server():
if request.method == 'POST':
if request.data:
rcv_data = json.loads(request.data)
threadWindow = Thread(target=Window())
rsp = post_actions(rcv_data)
threadWindow.daemon = True
threadWindow.start()
print(rcv_data['identity'])
if rsp:
......@@ -67,6 +64,4 @@ def Window():
window.mainloop()
return
threadServer = Thread(target=Server())
\ No newline at end of file
return
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment