@@ -120,7 +120,11 @@ def __init__(self, app:CTk.CTk) :
120
120
self .app_hieght = 800
121
121
122
122
app .resizable (False , False )
123
-
123
+
124
+ self .chatHistory = [
125
+ {"role" : "system" , "content" : systemPrompt }
126
+ ]
127
+
124
128
## Spawns screen constants...
125
129
header = CTk .CTkFrame (self .app , width = 600 , height = 75 , fg_color = self .bg_color_light , bg_color = self .bg_color , corner_radius = 0 )
126
130
header .place (x = 0 , y = 0 )
@@ -131,9 +135,8 @@ def __init__(self, app:CTk.CTk) :
131
135
settings_button = CTk .CTkButton (header , text = "⚙️" , font = self .header_font , fg_color = self .bg_color_light , hover_color = self .bg_color , border_width = 0 , command = lambda : self .director ("SettingButton" ), width = 60 , height = 50 )
132
136
settings_button .place (x = 525 , y = 12 )
133
137
134
- self .chatHistory = [
135
- {"role" : "system" , "content" : systemPrompt }
136
- ]
138
+ ai_chat_button = CTk .CTkButton (self .app , 100 , border_width = 0 , command = self .chat_with_ai , bg_color = self .bg_color_light , fg_color = self .bg_color_light , text = "Chat with AI!" , font = self .header_font )
139
+ ai_chat_button .place (x = 200 , y = 550 )
137
140
138
141
self .parse_unis ()
139
142
@@ -164,7 +167,7 @@ def intro_1st_slide(self,) :
164
167
self .all_screen_obj .append (intro_text_2 )
165
168
166
169
next_button = CTk .CTkButton (self .app , text = "Next" , font = self .text_font , fg_color = self .bg_color_light , bg_color = self .bg_color , hover_color = self .bg_color , border_width = 0 , command = self .intro_2nd_slide , width = 100 , height = 50 )
167
- next_button .place (x = 150 , y = 400 )
170
+ next_button .place (x = 350 , y = 450 )
168
171
self .all_screen_obj .append (next_button )
169
172
170
173
def intro_2nd_slide (self ,) :
@@ -179,11 +182,11 @@ def intro_2nd_slide(self,) :
179
182
self .all_screen_obj .append (self .name_tb )
180
183
181
184
back_button = CTk .CTkButton (self .app , text = "Back" , font = self .text_font , fg_color = self .bg_color_light , bg_color = self .bg_color , hover_color = self .bg_color , border_width = 0 , command = self .intro_1st_slide , width = 100 , height = 50 )
182
- back_button .place (x = 150 , y = 400 )
185
+ back_button .place (x = 150 , y = 450 )
183
186
self .all_screen_obj .append (back_button )
184
187
185
188
next_button = CTk .CTkButton (self .app , text = "Next" , font = self .text_font , fg_color = self .bg_color_light , bg_color = self .bg_color , hover_color = self .bg_color , border_width = 0 , command = self .intro_3rd_slide , width = 100 , height = 50 )
186
- next_button .place (x = 350 , y = 400 )
189
+ next_button .place (x = 350 , y = 450 )
187
190
self .all_screen_obj .append (next_button )
188
191
189
192
def intro_3rd_slide (self ,) :
@@ -268,11 +271,11 @@ def intro_4th_slide_ap_selector(self) :
268
271
self .all_screen_obj .append (self .ap_score )
269
272
270
273
back_button = CTk .CTkButton (self .app , text = "Back" , font = self .text_font , fg_color = self .bg_color_light , bg_color = self .bg_color , hover_color = self .bg_color , border_width = 0 , command = self .intro_4th_slide , width = 100 , height = 50 )
271
- back_button .place (x = 150 , y = 400 )
274
+ back_button .place (x = 150 , y = 450 )
272
275
self .all_screen_obj .append (back_button )
273
276
274
277
next_button = CTk .CTkButton (self .app , text = "Next" , font = self .text_font , fg_color = self .bg_color_light , bg_color = self .bg_color , hover_color = self .bg_color , border_width = 0 , command = self .intro_4th_slide_ap_selector_validator , width = 100 , height = 50 )
275
- next_button .place (x = 350 , y = 400 )
278
+ next_button .place (x = 350 , y = 450 )
276
279
self .all_screen_obj .append (next_button )
277
280
278
281
def intro_4th_slide_ap_selector_validator (self ,) :
@@ -549,7 +552,7 @@ def intro_7th_slide_club_entry_validator(self,) :
549
552
if club_purpose == "Academic" :
550
553
club_purpose = 3
551
554
elif club_purpose == "Volunteering" :
552
- club_purpose = 2
555
+ club_purpose = 2.5
553
556
else :
554
557
club_purpose = 1
555
558
@@ -852,13 +855,13 @@ def generate_report(self,) :
852
855
career_path = self .career_dd .get ()
853
856
assert (career_path != "-" )
854
857
855
- self .student_score = self .sat_score / 50 + self .gpa * 5
858
+ self .student_score = self .sat_score / 50 + self .gpa * 4. 5
856
859
857
860
## Very dumb but it works so :shrug:
858
861
tempTotal = 0
859
862
for i in self .taken_APs :
860
863
tempTotal += i .apValue
861
-
864
+
862
865
for i in self .taken_clubs :
863
866
tempTotal += i .clubValue
864
867
@@ -941,18 +944,14 @@ def generate_report(self,) :
941
944
uni_text .place (x = 15 , y = 20 )
942
945
self .all_screen_obj .append (uni_text )
943
946
944
- uni_button = CTk .CTkButton (layer , 75 , border_width = 0 , command = lambda : webbrowser . open ( f"https://google.com/search?q= { uni .name } " ), text = "More info" , font = self .small_font )
947
+ uni_button = CTk .CTkButton (layer , 75 , border_width = 0 , command = lambda university = uni .name : self . spawn_university_information_window ( university ), text = "More info" , font = self .small_font )
945
948
uni_button .place (x = 485 , y = 20 )
946
949
947
950
948
951
self .all_screen_obj .append (layer )
949
952
950
- ai_chat_button = CTk .CTkButton (self .app , 100 , border_width = 0 , command = self .chat_with_ai , bg_color = self .bg_color_light , fg_color = self .bg_color_light , text = "Chat with AI!" , font = self .header_font )
951
- ai_chat_button .place (x = 250 , y = 550 )
952
- self .all_screen_obj .append (ai_chat_button )
953
-
954
953
except :
955
- messagebox .showerror ("Invalid Career Path " , "Invalid Career Path !" )
954
+ messagebox .showerror ("Invalid Career Field " , "Invalid Career Field !" )
956
955
self .intro_11th_slide ()
957
956
958
957
def chat_with_ai (self ,) :
@@ -985,6 +984,7 @@ def parse_unis(self, ) :
985
984
for i in tier1s :
986
985
## Ugly but works
987
986
self .T1_UNIS .append (universities .university (i , tier1s [i ]["acc_rate" ], 5 , tier1s [i ]["75_sat" ], tier1s [i ]["50_sat" ], tier1s [i ]["25_sat" ], tier1s [i ]["tags" ]))
987
+ print (self .T1_UNIS [len (self .T1_UNIS )- 1 ].universityDifficulty )
988
988
989
989
with open ("tier2.json" , 'r' ) as t2 :
990
990
tier2s = json .load (t2 )
@@ -1009,11 +1009,11 @@ def parse_unis(self, ) :
1009
1009
1010
1010
for i in tier5s :
1011
1011
self .T5_UNIS .append (universities .university (i , tier5s [i ]["acc_rate" ], 1 , tier5s [i ]["75_sat" ], tier5s [i ]["50_sat" ], tier5s [i ]["25_sat" ], tier5s [i ]["tags" ]))
1012
+ print (self .T5_UNIS [len (self .T5_UNIS )- 1 ].universityDifficulty )
1012
1013
1013
1014
## Also a bit janky but also works
1014
1015
self .ALL_UNIS = self .T1_UNIS + self .T2_UNIS + self .T3_UNIS + self .T4_UNIS + self .T5_UNIS
1015
1016
1016
-
1017
1017
def sendMessage (self ) :
1018
1018
user_input = self .ai_entry .get ()
1019
1019
self .ai_entry .delete (0 , CTk .END )
@@ -1030,8 +1030,6 @@ def sendMessage(self) :
1030
1030
ai_message .place (x = 15 , y = self .current_y_ai )
1031
1031
self .current_y_ai += int (len (ai_response )/ 2 ) + 35
1032
1032
1033
-
1034
-
1035
1033
def sendOPENAIMessage (self , user_input ) -> str :
1036
1034
try :
1037
1035
self .chatHistory .append ({"role" : "user" , "content" : user_input })
@@ -1048,6 +1046,52 @@ def sendOPENAIMessage(self, user_input) -> str :
1048
1046
return response .choices [0 ].message .content
1049
1047
except Exception as e :
1050
1048
return f"An error occurred: { str (e )} "
1049
+
1050
+ def spawn_university_information_window (self , university_name ) :
1051
+ temp_chat = [{"role" : "system" , "content" : systemPrompt + ". Please do not use lists and keep the reponse in a paragraph." }] ## Janky but works
1052
+ temp_chat .append ({"role" : "user" , "content" : "Generate a short description of " + university_name + ". But be sure to include some tips for how to get in." })
1053
+
1054
+ try :
1055
+ response = openai .chat .completions .create (
1056
+ model = "gpt-4o" ,
1057
+ messages = temp_chat ,
1058
+ max_tokens = 300 ,
1059
+ n = 1 ,
1060
+ stop = None ,
1061
+ temperature = 0.7
1062
+ )
1063
+
1064
+ uni_description = response .choices [0 ].message .content
1065
+ print (uni_description )
1066
+ except Exception as e :
1067
+ messagebox .showerror ("Error!" , f"An error occurred: { str (e )} " )
1051
1068
1069
+ ## Programming crimes
1070
+ uni_description = list (uni_description )
1071
+
1072
+ space_count = 0
1073
+
1074
+ for i in range (len (uni_description )):
1075
+ if uni_description [i ] == " " :
1076
+ space_count += 1
1077
+ if space_count % 6 == 0 :
1078
+ uni_description [i ] = "\n " ## Very janky method of line seperation.
1079
+ i = i - 1 ## to deal with the fact that we technically added an additional character.
1080
+ uni_description = "" .join (uni_description )
1081
+
1082
+ uni_description_window = CTk .CTkToplevel (self .app ,)
1083
+ uni_description_window .config (bg = self .bg_color )
1084
+ uni_description_window .geometry ("600x600" )
1085
+ uni_description_window .title ("About " + university_name )
1086
+
1087
+ header = CTk .CTkFrame (uni_description_window , 600 , 75 , 0 , 0 , self .bg_color_light , self .bg_color_light , )
1088
+ header .place (x = 0 , y = 0 )
1089
+
1090
+ uni_name_header = CTk .CTkLabel (header , text = university_name , width = 360 , height = 50 , font = self .medium_font , text_color = self .app_text_color , bg_color = self .bg_color_light , fg_color = self .bg_color_light , )
1091
+ uni_name_header .place (x = 20 , y = 15 )
1092
+
1093
+ uni_text = CTk .CTkLabel (uni_description_window , 600 , 80 , bg_color = self .bg_color , fg_color = self .bg_color , text = uni_description , font = self .button_font )
1094
+ uni_text .place (x = 0 , y = 100 )
1095
+
1052
1096
1053
1097
var = app (CTk .CTk ())
0 commit comments