1
+ #region Libraries
2
+
1
3
import socket
2
4
import threading
3
5
import pyaudio
7
9
import win32api
8
10
import win32gui
9
11
12
+ #endregion
13
+
14
+ #region Mute Script
10
15
11
16
def mute (event = '' ):
12
17
WM_APPCOMMAND = 0x319
13
18
APPCOMMAND_MICROPHONE_VOLUME_MUTE = 0x180000
14
19
hwnd_active = win32gui .GetForegroundWindow ()
15
20
win32api .SendMessage (hwnd_active , WM_APPCOMMAND , None , APPCOMMAND_MICROPHONE_VOLUME_MUTE )
16
21
22
+ #endregion
23
+
24
+ #region Connected
25
+
17
26
def connected (ip , port , nickname ):
18
27
connectedGUI = Tk ()
19
28
connectedGUI .title ("Lessy - Voice Chat" )
20
- connectedGUI .geometry ("358x443 +380+320" )
29
+ connectedGUI .geometry ("158x143 +380+320" )
21
30
connectedGUI .resizable (False , False )
22
31
connectedGUI .configure (bg = "black" )
23
- connectedGUI .bind ('<Caps_Lock>' , mute )
32
+ connectedGUI .bind ('<Caps_Lock>' ,mute )
24
33
25
34
serverLabel = Label (connectedGUI , text = "{}:{}" .format (ip , port ), fg = "red" , bg = "black" )
26
35
serverLabel .place (x = 5 , y = 5 )
27
36
nicknameLabel = Label (connectedGUI , text = "{}" .format (nickname ), fg = "red" , bg = "black" )
28
- nicknameLabel .place (x = 320 ,y = 5 )
37
+ nicknameLabel .place (x = 5 ,y = 115 )
29
38
30
39
muteButton = Button (connectedGUI , width = 5 , text = "Mute" , bg = "black" , fg = "red" , command = mute )
31
40
muteButton .pack ()
32
- muteButton .place (x = 170 , y = 25 )
41
+ muteButton .place (x = 61 , y = 60 )
33
42
connectedGUI .mainloop ()
34
43
44
+ #endregion
45
+
46
+ #region Connect Function
35
47
36
48
def connect (server ,port ,nickname ,password ):
37
49
SERVER = server
38
50
PORT = port
39
51
PORT = int (PORT )
40
52
PASSWORD = password
41
- if PASSWORD == "Password " : # Set this line whatever you want to use for password!
53
+ if PASSWORD == "onurc123 " : # Set this line whatever you want to use for password!
42
54
mainGUI .destroy ()
43
55
threadPanelThread = threading .Thread (target = connected ,args = (SERVER , PORT , nickname ))
44
56
threadPanelThread .start ()
@@ -95,44 +107,50 @@ def receive():
95
107
def quit ():
96
108
sys .exit (0 )
97
109
110
+ #endregion
111
+
112
+ #region First Gui
98
113
99
114
if __name__ == "__main__" :
100
115
mainGUI = Tk ()
101
116
mainGUI .title ("Connect" )
102
117
mainGUI .geometry ("358x143+780+420" )
103
118
mainGUI .resizable (False , False )
104
- mainGUI .bind ("<Return>" , lambda : connect (serverEntry .get (), portEntry .get (), nicknameEntry .get (), passwordEntry .get (), mainGUI ))
119
+ mainGUI .configure (background = "black" )
120
+ mainGUI .bind ("<Return>" , lambda x : connect (serverEntry .get (), portEntry .get (), nicknameEntry .get (), passwordEntry .get ()), mainGUI )
105
121
# ServerLabel
106
- serverLabel = Label (mainGUI ,text = "Ip adress:" ,fg = "black" )
122
+ serverLabel = Label (mainGUI ,text = "Ip adress:" ,fg = "red" , bg = " black" )
107
123
serverLabel .place (x = 18 , y = 5 )
108
124
# ServerEntry
109
- serverEntry = Entry (mainGUI , width = 34 , fg = "black " , borderwidth = 1 , relief = "solid" )
125
+ serverEntry = Entry (mainGUI , width = 34 , fg = "red " , borderwidth = 1 , relief = "solid" )
110
126
serverEntry .pack (side = RIGHT )
111
127
serverEntry .place (x = 20 , y = 30 )
112
128
serverEntry .focus ()
113
129
# PortLabel
114
- portLabel = Label (mainGUI , text = "Port:" , fg = "black" )
130
+ portLabel = Label (mainGUI , text = "Port:" , fg = "red" , bg = "black" )
115
131
portLabel .place (x = 240 , y = 5 )
116
132
# PortEntry
117
- portEntry = Entry (mainGUI , width = 15 , fg = "black " , borderwidth = 1 , relief = "solid" )
133
+ portEntry = Entry (mainGUI , width = 15 , fg = "red " , borderwidth = 1 , relief = "solid" )
118
134
portEntry .pack ()
119
135
portEntry .place (x = 242 , y = 30 )
120
136
# NicknameLabel
121
- nicknameLabel = Label (mainGUI , text = "Nickname:" ,fg = "black" )
137
+ nicknameLabel = Label (mainGUI , text = "Nickname:" ,fg = "red" , bg = "black" )
122
138
nicknameLabel .place (x = 18 , y = 55 )
123
139
# NicknameEntry
124
- nicknameEntry = Entry (mainGUI , width = 34 , fg = "black " , borderwidth = 1 , relief = "solid" )
140
+ nicknameEntry = Entry (mainGUI , width = 34 , fg = "red " , borderwidth = 1 , relief = "solid" )
125
141
nicknameEntry .pack (side = RIGHT )
126
142
nicknameEntry .place (x = 20 , y = 80 )
127
143
# PasswordLabel
128
- passwordLabel = Label (mainGUI , text = "Password:" ,fg = "black" )
144
+ passwordLabel = Label (mainGUI , text = "Password:" ,fg = "red" , bg = "black" )
129
145
passwordLabel .place (x = 240 ,y = 55 )
130
146
# PasswordEntry
131
- passwordEntry = Entry (mainGUI , width = 15 , fg = "black " , borderwidth = 1 , relief = "solid" )
147
+ passwordEntry = Entry (mainGUI , width = 15 , fg = "red " , borderwidth = 1 , relief = "solid" )
132
148
passwordEntry .pack ()
133
149
passwordEntry .place (x = 242 , y = 80 )
134
- # LoginButton
135
- loginButton = Button (mainGUI , width = 7 , text = "Log In" , borderwidth = 1 , relief = "solid" ,command = lambda : connect (serverEntry .get (), portEntry .get (), nicknameEntry .get (), passwordEntry .get ()))
136
- loginButton .pack ()
137
- loginButton .place (x = 155 , y = 110 )
138
- mainGUI .mainloop ()
150
+ # ConnectButton
151
+ connectButton = Button (mainGUI , width = 7 , text = "Connect" , bg = "black" ,fg = "red" ,borderwidth = 1 , relief = "solid" ,command = lambda : connect (serverEntry .get (), portEntry .get (), nicknameEntry .get (), passwordEntry .get ()))
152
+ connectButton .pack ()
153
+ connectButton .place (x = 155 , y = 110 )
154
+ mainGUI .mainloop ()
155
+
156
+ #endregion
0 commit comments