forked from nicolomantini/LinkedIn-Easy-Apply-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loginGUI.py
265 lines (191 loc) · 9.04 KB
/
loginGUI.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
import tkinter as tk
from tkinter import font as tkfont
import tkinter.messagebox as tm
from urllib.request import urlopen
from tkinter import filedialog
class LoginGUI(tk.Tk):
def __init__(self,*args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
self.title_font = tkfont.Font(family='Helvetica', size=18, weight="bold", slant="italic")
self.subtitle_font = tkfont.Font(family='Helvetica', size=12, weight="bold", slant="italic")
# the container is where we'll stack a bunch of frames
# on top of each other, then the one we want visible
# will be raised above the others
container = tk.Frame(self)
container.grid(row = 10)
label = tk.Label(self, text="Easy Apply Bot", font=self.title_font)
label.grid(row=0,columnspan = 2, pady=10)
self.frames = {}
for F in (StartPage, PageOne, PageTwo, PageThree, PageFour, PageFive, PageSix):
page_name = F.__name__
frame = F(parent=container, controller=self)
self.frames[page_name] = frame
# put all of the pages in the same location;
# the one on the top of the stacking order
# will be the one that is visible.
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame("StartPage")
def show_frame(self, page_name):
'''Show a frame for the given page name'''
frame = self.frames[page_name]
frame.tkraise()
class StartPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
#title
label = tk.Label(self, text="Insert your LinkedIn credentials", font=controller.subtitle_font)
label.grid(row=2,columnspan = 2, pady=10)
#Username and password
label_username = tk.Label(self, text="Username")
label_password = tk.Label(self, text="Password")
label_username.grid(row=4, column=0)
label_password.grid(row=5, column=0)
self.entry_username = tk.Entry(self)
self.entry_password = tk.Entry(self, show="*")
self.entry_username.grid(row=4, column=1)
self.entry_password.grid(row=5, column=1)
#button = tk.Button(self, text="Next", command=lambda: controller.show_frame("PageOne"))
button = tk.Button(self, text="Next", command= self.auth)
button.grid(row=7, columnspan=2, pady=30)
def auth (self):
self.username = self.entry_username.get()
self.password = self.entry_password.get()
self.controller.show_frame("PageOne")
class PageOne(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
#title
label = tk.Label(self, text="Choose your LinkedIn language", font=controller.subtitle_font)
label.grid(row=2,columnspan = 2, pady=10)
#language
self.var = tk.StringVar()
R1 = tk.Radiobutton(self, text="English", variable=self.var, value="en")#,command=self.sel)
R1.grid(row=4, column=0, sticky = "W")
R2 = tk.Radiobutton(self, text="Spanish", variable=self.var, value="es")#,command=self.sel)
R2.grid(row=5,column=0, sticky = "W")
R3 = tk.Radiobutton(self, text="Portuguese", variable=self.var, value="pt")#,command=self.sel)
R3.grid(row=6,column=0, sticky = "W")
self.var.set("en")
#button
button = tk.Button(self, text="Next",command=self.sel)
button.grid(row=7, columnspan=2, pady=30)
def sel(self):
self.language = self.var.get()
self.controller.show_frame("PageTwo")
class PageTwo(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
#title
label = tk.Label(self, text="Type your desired job title \n (e.g. Consulting innovation)", font=controller.subtitle_font)
label.grid(row=2,columnspan = 2, pady=10)
#job tite
label_position = tk.Label(self, text="job title")
label_position.grid(row=3, column=0)
self.entry_position = tk.Entry(self)
self.entry_position.grid(row=3, column=1)
#button
button = tk.Button(self, text="Next",command= self.sel_position)
button.grid(row=7, columnspan=2, pady=30)
def sel_position (self):
self.position = self.entry_position.get()
self.controller.show_frame("PageThree")
class PageThree(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
#title
label = tk.Label(self, text="Where are you looking for a job?", font=controller.subtitle_font)
label.grid(row=2,columnspan = 2, pady=10)
#Location
self.var = tk.IntVar()
R1 = tk.Radiobutton(self, text="Worldwide", variable=self.var, value=1)#,command=self.sel_location_code)
R1.grid(row=3, column=0, sticky = "W")
R2 = tk.Radiobutton(self, text="In a specific Country", variable=self.var, value=2)#,command=self.sel_location_code)
R2.grid(row=4,column=0, sticky = "W")
R3 = tk.Radiobutton(self, text="In a specific State", variable=self.var, value=3)#,command=self.sel_location_code)
R3.grid(row=5,column=0, sticky = "W")
R4 = tk.Radiobutton(self, text="In a specific City", variable=self.var, value=4)#,command=self.sel_location_code)
R4.grid(row=6,column=0, sticky = "W")
self.var.set(1)
#button
#button = tk.Button(self, text="Next",command=lambda: controller.show_frame("PageFour"))
button = tk.Button(self, text="Next",command= self.sel_location_code)
button.grid(row=7, columnspan=2, pady=30)
def sel_location_code(self):
self.location_code = self.var.get()
if self.location_code == 1:
self.location = "Worldwide"
self.controller.show_frame("PageFive")
else:
self.controller.show_frame("PageFour")
class PageFour(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
#title
label = tk.Label(self, text="loc2", font=controller.subtitle_font)
label.grid(row=2,columnspan = 2, pady=10)
#type position
label_location = tk.Label(self, text="Enter the name:")
label_location.grid(row=2, column=0)
self.entry_location = tk.Entry(self)
self.entry_location.grid(row=2, column=1)
#button
#button = tk.Button(self, text="Next",command=lambda: controller.show_frame("StartPage"))
button = tk.Button(self, text="Next",command= self.sel_location)
button.grid(row=7, columnspan=2, pady=30)
def sel_location(self):
self.location = self.entry_location.get()
self.controller.show_frame("PageFive")
class PageFive(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
self.summary()
def summary (self):
label = tk.Label(self, text="Upload your CV", font=self.controller.subtitle_font)
label.grid(row=2,columnspan = 2, pady=10)
#button1 = tk.Button(self, text="Next", command=lambda: controller.show_frame("PageOne"))
self.resumeloctn = ''
button1 = tk.Button(self, text="Upload",command=self.CV)
button1.grid(row=7, column = 1, pady=30)
button2 = tk.Button(self, text="Next",command= lambda: self.controller.show_frame("PageSix"))
button2.grid(row=7, column = 2, pady=30)
def CV (self):
#root = tk.Tk()
self.resumeloctn = filedialog.askopenfilename(parent=self, initialdir="/", title='Please select your curriculum')
#root.destroy()
#print(self.resumeloctn)
return
class PageSix(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
self.summary()
def summary (self):
label = tk.Label(self, text="Ready to start applying?", font=self.controller.subtitle_font)
label.grid(row=2,columnspan = 2, pady=10)
#button1 = tk.Button(self, text="Next", command=lambda: controller.show_frame("PageOne"))
button = tk.Button(self, text="START!",command=self.finish)
button.grid(row=7, columnspan=2, pady=30)
def finish(self):
self.controller.destroy()
# if __name__ == "__main__":
# print("\nEasy Apply Bot\n")
# app = LoginGUI()
# app.mainloop()
# #get user info
# username=app.frames["StartPage"].username
# password=app.frames["StartPage"].password
# language=app.frames["PageOne"].language
# position=app.frames["PageTwo"].position
# location_code=app.frames["PageThree"].location_code
# if location_code == 1:
# location=app.frames["PageThree"].location
# else:
# location = app.frames["PageFour"].location
# resumeloctn=app.frames["PageFive"].resumeloctn
# print(username,password, language, position, location_code, location, resumeloctn)