Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BahnProjekt V
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Helmuth Feide
BahnProjekt V
Commits
f3c9d242
Commit
f3c9d242
authored
2 years ago
by
drouver-helmuth
Browse files
Options
Downloads
Patches
Plain Diff
use multithreading to start server
parent
67d221cf
Branches
Branches containing commit
Tags
V0.6
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main_pro.py
+16
-2
16 additions, 2 deletions
src/main_pro.py
src/server.py
+2
-7
2 additions, 7 deletions
src/server.py
with
18 additions
and
9 deletions
src/main_pro.py
+
16
−
2
View file @
f3c9d242
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
...
...
This diff is collapsed.
Click to expand it.
src/server.py
+
2
−
7
View file @
f3c9d242
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment