How to run python in the background?

The code itself:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from tkinter import *
from tkinter import messagebox as mb
import os


def start():
 import socket
 sock = socket.socket()
 sock.bind(('192.168.1.10', 9090))
sock.listen(1)
 conn, addr = sock.accept()
 mb.showinfo("Conected", "---:" + str(addr))
 while True:
 data = conn.recv(10000)
 mb.showinfo("Send_", "---:" + str(data))
print(data)
 if not data:
break
conn.send(data.upper())


root = Tk()
root.title("---")
lab1 = Label(root, text="---")
lab1.pack()
but1 = Button(root, text="---")
but1.pack()
but2 = Button(root, text="---", command=start)
but2.pack()

root.mainloop()

conn.close()

How to do that-start method worked in the background?
thanks in advance)
April 3rd 20 at 17:13
1 answer
April 3rd 20 at 17:15
To run it in a separate thread.
I don't know how... - helmer.Kessler69 commented on April 3rd 20 at 17:18
@helmer.Kessler69, well, learn. You gave the whole context, Googly - do not want. Or maybe better to leave this difficult thing is programming? - ewald_Ullrich commented on April 3rd 20 at 17:21
https://www.oreilly.com/library/view/python-cookbo... - karianne_Morar88 commented on April 3rd 20 at 17:24

Find more questions by tags Python