nearly finished client GUI with listening support

This commit is contained in:
Xevion
2021-01-08 14:28:01 -06:00
parent e754221aac
commit 4dc14d118b
15 changed files with 515 additions and 98 deletions

40
client/main.py Normal file
View File

@@ -0,0 +1,40 @@
from PyQt5.QtWidgets import QApplication
from client.gui import MainWindow
import socket
import threading
# nickname = input("Nickname: ")
app = QApplication([])
app.setApplicationName("TCPChat Client")
m = MainWindow()
# client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# client.connect(('127.0.0.1', 55555))
#
# def receive():
# while True:
# try:
# message = client.recv(1024).decode('ascii')
# if message == 'NICK':
# client.send(nickname.encode('ascii'))
# else:
# m.addMessage(message)
# # print(message)
# except:
# print("Error! Disconnecting.")
# client.close()
# break
#
# Sending Messages To Server
# def write():
# while True:
# message = '{}: {}'.format(nickname, input(''))
# client.send(message.encode('ascii'))
#
# Starting Threads For Listening And Writing
# receive_thread = threading.Thread(target=receive)
# receive_thread.start()
app.exec_()