I'm sure it's a simple fix but I'm just spacing out here on my basics. I need to incorporate a Gui that simply pops up and states that a connection has been made between the client and the server.
I can get the GUI to pop up when it is on top of my code with all of my variables but It won't run underneath my code which is where the connection that I need it to display is defined.
# it will run but (address) is not defined yet
import socket
from tkinter import *
root = Tk()
theLabel = Label(root,text="Connection from {address} has been established.")
theLabel.pack()
root.mainloop()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((socket.gethostname(), 1234))
s.listen(5)
while True:
clientsocket, address = s.accept()
print(f"Connection from {address} has been established.")
clientsocket.send(bytes("HELL YEAH FAM!!! WE DID IT!!","utf-8"))
clientsocket.close()
it has no error message, it just won't run the GUI.