1313
1414app_title = 'ExamMaker-V0.3'
1515sg .SetOptions (font = 'any 11' , auto_size_buttons = True , progress_meter_border_depth = 0 , border_width = 1 )
16+ sg .set_global_icon ('input/LogoIcon.ico' )
1617
1718menu_def = [['Archivo' , ['Salir' ]],['Ayuda' , ["Agradecimientos" , 'Acerca de...' ]]]
1819
20+ #Thanks MikeTheWatchGuy
1921def place (elem ):
2022 return sg .Column ([[elem ]], pad = (0 ,0 ))
2123
@@ -31,7 +33,7 @@ def AnswerGui(cur, realAnswer, userAnswer, Sentence, justification):
3133
3234 ]
3335
34- window = sg .Window ('ExamMaker - Answer' , layout , icon = r 'input/LogoIcon.ico' )
36+ window = sg .Window ('ExamMaker - Answer' , layout , icon = 'input/LogoIcon.ico' )
3537 while True :
3638 event , values = window .read ()
3739
@@ -59,7 +61,7 @@ def ConclusionGui(con, windowTest, windowInitial, totalAnswers, correctAnswers):
5961 [sg .Button ('OK' )]
6062 ]
6163
62- window = sg .Window ('ExamMaker - Answer' , layout , icon = r 'input/LogoIcon.ico' )
64+ window = sg .Window ('ExamMaker - Answer' , layout , icon = 'input/LogoIcon.ico' )
6365 while True :
6466 event , values = window .read ()
6567
@@ -85,28 +87,28 @@ def TestGui(con, cur, numberQuest, questChoice, windowInitial):
8587 layout = [
8688 [sg .Text (GetThings (cur , randomQuestions [n ], option = "Category" ), font = ('Helvetica' , 16 ), justification = 'left' , key = '-CAT-' ),
8789 sg .Text (font = ('Helvetica' , 16 ),size = (12 ,1 ), justification = 'right' , key = '-TIME-' ),
88- sg .Text (f'{ n + 1 } de { questChoice } ' , size = (11 ,1 ), key = "-COUNTER-" ,justification = "right" , font = ("Helvetica" , 16 ))],
90+ sg .Text (f'{ n + 1 } de { questChoice } ' , size = (10 ,1 ), key = "-COUNTER-" ,justification = "right" , font = ("Helvetica" , 16 ))],
8991 [sg .Text ('' )],
9092 [sg .Frame ("Pregunta" , layout = [[sg .Multiline
9193 (default_text = GetThings (cur , randomQuestions [n ]),
92- size = (43 ,5 ), key = "-QUESTION-" , disabled = True , enter_submits = False )]])],
93- [sg .Text ('' , key = "-SPACE1 -" , visible = False )],
94- [ sg . Column ([[ sg . Button ( 'VER IMAGEN ADJUNTA A LA PREGUNTA' , key = "-IMAGE -" ,enable_events = True , visible = False )]] , vertical_alignment = 'center' , justification = 'center' )],
94+ size = (42 ,5 ), key = "-QUESTION-" , disabled = True , enter_submits = False )]])],
95+ [sg .pin ( sg . Column ([[ sg . Text ('' )],[ sg . Button ( 'VER IMAGEN ADJUNTA A LA PREGUNTA' , key = "-IMAGE -" ,enable_events = True , visible = True )]],
96+ key = "-COLIMAGE -" ,visible = False , vertical_alignment = 'center' , justification = 'center' , element_justification = 'center' , expand_x = True , expand_y = True ), expand_x = True , vertical_alignment = 'center' , expand_y = True )],
9597 [sg .Text ('' )],
9698 [sg .Frame ("Posibles Respuestas" , layout = [[sg .Multiline
9799 (default_text = GetThings (cur , randomQuestions [n ], option = "Answer" ),
98- size = (43 ,5 ), key = "-ANSWER-" , disabled = True , enter_submits = False )]])],
100+ size = (42 ,5 ), key = "-ANSWER-" , disabled = True , enter_submits = False )]])],
99101 [sg .Text ('' )],
100- [sg .InputText ('Respuesta elegida: ' , size = (40 ,1 ), readonly = True , key = '-IN-' ),
102+ [sg .InputText ('Respuesta elegida: ' , size = (39 ,1 ), readonly = True , key = '-IN-' ),
101103 sg .Button (image_filename = "input/DeleteAnswer.png" , key = "-DELETE-" , enable_events = True ,image_size = (40 ,30 ), image_subsample = 13 )],
102104 [sg .Text ('' )],
103- [sg .Button ('A' ,size = (11 ,1 ),visible = True ), sg .Button ('B' ,size = (11 ,1 ),visible = True ), place (sg .Button ('C' ,size = (11 ,1 ),visible = False ))],
104- [place (sg .Button ('D' ,size = (11 ,1 ),visible = False )), place (sg .Button ('E' ,size = (11 ,1 ),visible = False )), place (sg .Button ('F' ,size = (11 ,1 ),visible = False ))],
105+ [sg .Button ('A' ,size = (12 ,1 ),visible = True ), sg .Button ('B' ,size = (12 ,1 ),visible = True ), sg . pin (sg .Button ('C' ,size = (12 ,1 ),visible = False ))],
106+ [sg . pin (sg .Button ('D' ,size = (12 ,1 ),visible = False )), sg . pin (sg .Button ('E' ,size = (12 ,1 ),visible = False )), sg . pin (sg .Button ('F' ,size = (12 ,1 ),visible = False ))],
105107 [sg .Text ('' )],
106108 [sg .Column ([[sg .Button ('Confirmar Respuesta' , key = "-ENTER-" , enable_events = True )]], vertical_alignment = 'center' , justification = 'center' )]
107109 ]
108110
109- window = sg .Window ('ExamMaker' , layout ,icon = r 'input/LogoIcon.ico' )
111+ window = sg .Window ('ExamMaker' , layout ,icon = 'input/LogoIcon.ico' )
110112
111113 timeRunning , counter = True , 0
112114 answerNeeds = True
@@ -128,11 +130,9 @@ def TestGui(con, cur, numberQuest, questChoice, windowInitial):
128130 if answerImage == True :
129131 imageManager = GetThings (cur , randomQuestions [n ], option = "Image" )
130132 if imageManager != None :
131- window .Element ("-IMAGE-" ).update (visible = True )
132- window .Element ("-SPACE1-" ).update (visible = True )
133+ window .Element ("-COLIMAGE-" ).update (visible = True )
133134 elif imageManager == None :
134- window .Element ("-SPACE1-" ).update (visible = False )
135- window .Element ("-IMAGE-" ).update (visible = False )
135+ window .Element ("-COLIMAGE-" ).update (visible = False )
136136 answerImage = False
137137
138138 if answerNeeds == True :
@@ -249,11 +249,11 @@ def TestGui(con, cur, numberQuest, questChoice, windowInitial):
249249 break
250250
251251 except AttributeError :
252- sg .Popup ("No has introducido respuesta" ,icon = r 'input/LogoIcon.ico' )
252+ sg .Popup ("No has introducido respuesta" ,icon = 'input/LogoIcon.ico' )
253253 continue
254254
255255 except UnboundLocalError :
256- sg .Popup ("No has introducido respuesta" ,icon = r 'input/LogoIcon.ico' )
256+ sg .Popup ("No has introducido respuesta" ,icon = 'input/LogoIcon.ico' )
257257 continue
258258
259259 if os .path .exists ("TestDB.db" ):
@@ -279,13 +279,13 @@ def InitialGui():
279279 [sg .Text ("" , font = ParamsEmpty [1 ])],
280280 [sg .Text ("Selecciona la DB: " , size = ParamsH3 [0 ], font = ParamsH3 [1 ]),
281281 sg .Input (key = "-FILE1-" ,size = ParamsH3 [0 ], font = ParamsH3 [1 ], enable_events = True ),
282- sg .FileBrowse (button_text = "Seleccionar" ,key = "-SUB1-" , change_submits = True , enable_events = True , tooltip = "Selecciona la base de datos" )],
282+ sg .FileBrowse (button_text = "Seleccionar" , file_types = [( 'Archivos zip' , '*.zip' )], key = "-SUB1-" , change_submits = True , enable_events = True , tooltip = "Selecciona la base de datos" )],
283283 [sg .Text ('No se ha introducido DB' , size = ParamsH2 [0 ], font = ParamsH3 [1 ],text_color = "#ffafad" , key = "-INF1-" )],
284284 ])],
285285
286286 [sg .Text ("" , font = ParamsEmpty [1 ])],
287287
288- [sg .Text ("Número de preguntas :" , size = ParamsH3 [0 ], font = ParamsH3 [1 ]),
288+ [sg .Text ("Preguntas para examen :" , size = ParamsH3 [0 ], font = ParamsH3 [1 ]),
289289
290290 sg .Combo (size = (10 ,5 ), auto_size_text = False , readonly = True , enable_events = True , tooltip = "Desactivado. Selecciona DB antes" , default_value = [0 ],values = [0 ], disabled = True , key = "-LIST1-" )],
291291
@@ -300,14 +300,14 @@ def InitialGui():
300300 [sg .Frame ('Insertar Base de datos online' , layout = [
301301 [sg .Text ("" , font = ParamsEmpty [1 ])],
302302 [sg .Text ("Selecciona la DB: " , size = ParamsH3 [0 ], font = ParamsH3 [1 ]),
303- sg .Combo (values = [],tooltip = "Pulsa'Refrescar'" ,key = "-FILE2-" ,size = ParamsH3 [0 ], font = ParamsH3 [1 ], enable_events = True ),
303+ sg .Combo (values = [], readonly = True , tooltip = "Pulsa'Refrescar'" ,key = "-FILE2-" ,size = ParamsH3 [0 ], font = ParamsH3 [1 ], enable_events = True ),
304304 sg .Button ("Refrescar" , key = "-SUB2-" , change_submits = True , enable_events = True )],
305305 [sg .Text ('No se ha introducido DB' , size = ParamsH2 [0 ], font = ParamsH3 [1 ],text_color = "#ffafad" , key = "-INF2-" )],
306306 ])],
307307
308308 [sg .Text ("" , font = ParamsEmpty [1 ])],
309309
310- [sg .Text ("Número de preguntas :" , size = ParamsH3 [0 ], font = ParamsH3 [1 ]),
310+ [sg .Text ("Preguntas para examen :" , size = ParamsH3 [0 ], font = ParamsH3 [1 ]),
311311
312312 sg .Combo (size = (10 ,5 ),auto_size_text = False , readonly = True , enable_events = True , default_value = [0 ],values = [0 ], disabled = True , key = "-LIST2-" )],
313313
@@ -321,7 +321,7 @@ def InitialGui():
321321 ]
322322
323323 checkTab = 2
324- window = sg .Window ('ExamMaker - Pantalla inicial' , layout , icon = r 'input/LogoIcon.ico' )
324+ window = sg .Window ('ExamMaker - Pantalla inicial' , layout , icon = 'input/LogoIcon.ico' )
325325 while True :
326326 event , values = window .read ()
327327
@@ -380,8 +380,8 @@ def InitialGui():
380380 numberQuest = cur .fetchall ()[0 ][0 ]
381381
382382 window .Element (f'-INF{ checkTab } -' ).Update (f"Número de preguntas introducidas: { numberQuest } " , text_color = "#ffff80" )
383- window .Element (f'-LIST{ checkTab } -' ).Update (values = list (range (1 ,numberQuest + 1 )), disabled = False )
384- window .Element (f"-LIST{ checkTab } -" ).set_tooltip ("Haz click encima para seleccionar " )
383+ window .Element (f'-LIST{ checkTab } -' ).Update (values = list (range (1 ,numberQuest + 1 )), disabled = False , readonly = True )
384+ window .Element (f"-LIST{ checkTab } -" ).set_tooltip ("Selecciona número de preguntas que tendrá el examen " )
385385
386386
387387 elif event == f"-SUB2-" :
0 commit comments