@@ -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 ,) :
@@ -941,16 +944,12 @@ 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
954
messagebox .showerror ("Invalid Career Path" , "Invalid Career Path!" )
956
955
self .intro_11th_slide ()
@@ -1045,5 +1044,52 @@ def sendOPENAIMessage(self, user_input) -> str :
1045
1044
return response .choices [0 ].message .content
1046
1045
except Exception as e :
1047
1046
return f"An error occurred: { str (e )} "
1047
+
1048
+ def spawn_university_information_window (self , university_name ) :
1049
+ temp_chat = [{"role" : "system" , "content" : systemPrompt + ". Please do not use lists and keep the reponse in a paragraph." }] ## Janky but works
1050
+ 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." })
1051
+
1052
+ try :
1053
+ response = openai .chat .completions .create (
1054
+ model = "gpt-4o" ,
1055
+ messages = temp_chat ,
1056
+ max_tokens = 300 ,
1057
+ n = 1 ,
1058
+ stop = None ,
1059
+ temperature = 0.7
1060
+ )
1061
+
1062
+ uni_description = response .choices [0 ].message .content
1063
+ print (uni_description )
1064
+ except Exception as e :
1065
+ messagebox .showerror ("Error!" , f"An error occurred: { str (e )} " )
1066
+
1067
+ ## Programming crimes
1068
+ uni_description = list (uni_description )
1069
+
1070
+ space_count = 0
1071
+
1072
+ for i in range (len (uni_description )):
1073
+ if uni_description [i ] == " " :
1074
+ space_count += 1
1075
+ if space_count % 6 == 0 :
1076
+ uni_description [i ] = "\n " ## Very janky method of line seperation.
1077
+ i = i - 1 ## to deal with the fact that we technically added an additional character.
1078
+ uni_description = "" .join (uni_description )
1079
+
1080
+ uni_description_window = CTk .CTkToplevel (self .app ,)
1081
+ uni_description_window .config (bg = self .bg_color )
1082
+ uni_description_window .geometry ("600x600" )
1083
+ uni_description_window .title ("About " + university_name )
1084
+
1085
+ header = CTk .CTkFrame (uni_description_window , 600 , 75 , 0 , 0 , self .bg_color_light , self .bg_color_light , )
1086
+ header .place (x = 0 , y = 0 )
1087
+
1088
+ 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 , )
1089
+ uni_name_header .place (x = 20 , y = 15 )
1090
+
1091
+ 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 )
1092
+ uni_text .place (x = 0 , y = 100 )
1093
+
1048
1094
1049
1095
var = app (CTk .CTk ())
0 commit comments