-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (23 loc) · 789 Bytes
/
main.py
File metadata and controls
27 lines (23 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import PySimpleGUI as sg
from client import Client
if __name__ == '__main__':
sg.theme('DarkAmber')
layout = [
[sg.Text('Server IP'), sg.Input(default_text="localhost" ,key='-IP-')],
[sg.Text('Port'), sg.Input(default_text=9999, key='-PORT-')],
[sg.Text('Your Name'), sg.Input('test', key='-NAME-')],
[sg.Button('Connect')]
]
window = sg.Window('Chat App - Connect to Server', layout)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
if event == 'Connect':
ip = values['-IP-']
port = int(values['-PORT-'])
name = values['-NAME-']
window.hide()
Client(ip, port, name)
break
window.close()