Skip to content

Commit 6f272fb

Browse files
committed
v0.9.0
Updated: Screenshot button & Next button (Screenshot)
1 parent 724a5da commit 6f272fb

File tree

2 files changed

+86
-43
lines changed

2 files changed

+86
-43
lines changed

MyCards.py

Lines changed: 82 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Version:
2-
#0.8.0
2+
#0.9.0
33
###
44
import os ### Librairie #4
55
import csv ### .py & Librairie #5
@@ -229,10 +229,38 @@ def Update(Numéro):
229229
canvas.create_text((s_screen_width/scnd_colonne), (670), text=N7_2,fill=s_font_color, font=s_font_family) ##7
230230
else: ##7
231231
canvas.create_text((s_screen_width/scnd_colonne), (640), text=BaseDeMots[Numéro][7],fill=s_font_color, font=s_font_family) ##7
232-
####
232+
233+
#################################################################################################################################
234+
# Update color of screenshot button if screenshot is found
235+
236+
if ImageRelated(Only_Return_True_if_there_is_an_image=True)==True:
237+
btn7 = Button(root, text =Language[8], activebackground=s_button_color_active,bg=s_button_color_unactive_scr,fg=s_button_texte_color_scr,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageRelated) #Bouton#// Screenshots
238+
btn7.place(rely=0, relx=0, x=0, y=150,anchor=W) #old y=100 (v0.8.0) -> 150 (v0.9.0) | Change oder of buttons
239+
else:
240+
btn7 = Button(root, text =Language[8], activebackground=s_button_color_active,bg=s_button_color_unactive,fg=s_button_texte_color,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageRelated) #Bouton#// Screenshots
241+
btn7.place(rely=0, relx=0, x=0, y=150,anchor=W) #old y=100 (v0.8.0) -> 150 (v0.9.0) | Change oder of buttons
242+
243+
###
244+
if ImageNext(Only_Return_True_if_there_is_an_image=True)==True:
245+
btn8 = Button(root, text =Language[9], activebackground=s_button_color_active,bg=s_button_color_unactive_scr,fg=s_button_texte_color_scr,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageNext) #Bouton#// Next Image
246+
btn8.place(rely=0, relx=0, x=0, y=100,anchor=W) #old y=150 (v0.8.0) -> 100 (v0.9.0) | Change oder of buttons
247+
else:
248+
btn8 = Button(root, text =Language[9], activebackground=s_button_color_active,bg=s_button_color_unactive,fg=s_button_texte_color,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageNext) #Bouton#// Next Image
249+
btn8.place(rely=0, relx=0, x=0, y=100,anchor=W) #old y=150 (v0.8.0) -> 100 (v0.9.0) | Change oder of buttons
250+
###
251+
""" #Not working
252+
if ImageBack(Only_Return_True_if_there_is_an_image=True)==True:
253+
btn9 = Button(root, text =Language[10], activebackground=s_button_color_active,bg=s_button_color_unactive_scr,fg=s_button_texte_color_scr,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageBack) #Bouton#// Back Image
254+
btn9.place(rely=0, relx=0, x=0, y=200,anchor=W)
255+
else:
256+
btn9 = Button(root, text =Language[10], activebackground=s_button_color_active,bg=s_button_color_unactive,fg=s_button_texte_color,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageBack) #Bouton#// Back Image
257+
btn9.place(rely=0, relx=0, x=0, y=200,anchor=W)
258+
"""
259+
260+
####
233261

234262
######### Images #########
235-
def ImageRelated():
263+
def ImageRelated(Only_Return_True_if_there_is_an_image=False):
236264
global ListScrennshot
237265
global ImageNum
238266
global Activated
@@ -280,52 +308,66 @@ def ImageRelated():
280308
Activated=False
281309
print(Final,"Final")
282310
else: #If there is a screenshot
283-
print('Found a screenshot for this word')
284-
print(Final,"Final")
285-
img = PhotoImage(file=path+Final[0])
286-
if adjust_screenshot_size==True:
287-
img = img.zoom(2)
288-
img=img.subsample(3)
289-
canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, image=img)
290-
canvas.create_image()
291-
Activated=True
292-
return Activated
311+
if Only_Return_True_if_there_is_an_image==False:
312+
print('Found a screenshot for this word')
313+
print(Final,"Final")
314+
img = PhotoImage(file=path+Final[0])
315+
if adjust_screenshot_size==True:
316+
img = img.zoom(2)
317+
img=img.subsample(3)
318+
canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, image=img)
319+
canvas.create_image()
320+
Activated=True
321+
return Activated
322+
else:
323+
return True
293324
### End of ImageRelated()
294-
def ImageNext():
325+
def ImageNext(Only_Return_True_if_there_is_an_image=False):
295326
global ImageNum
296327
global Activated
297328
if Activated==True:
298329
path = Screenshots_Folder_Path
299330
dir_list = os.listdir(path)
300-
if len(Final)>ImageNum+1:
301-
print('ok Next')
302-
ImageNum+=1
303-
img = PhotoImage(file=path+Final[ImageNum])
304-
if adjust_screenshot_size==True:
305-
img = img.zoom(2)
306-
img=img.subsample(3)
307-
canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img)
308-
canvas.create_image()
331+
if Only_Return_True_if_there_is_an_image==False:
332+
if len(Final)>ImageNum+1:
333+
print('ok Next')
334+
ImageNum+=1
335+
img = PhotoImage(file=path+Final[ImageNum])
336+
if adjust_screenshot_size==True:
337+
img = img.zoom(2)
338+
img=img.subsample(3)
339+
canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img)
340+
canvas.create_image()
341+
else:
342+
ImageRelated()
309343
else:
310-
ImageRelated()
344+
if len(Final)>ImageNum+1:
345+
return True
346+
else:
347+
return False
311348
### End of ImageNext()
312-
def ImageBack():
349+
def ImageBack(Only_Return_True_if_there_is_an_image=False):
313350
global ImageNum
314351
global Activated
315352
if Activated==True:
316353
path = Screenshots_Folder_Path
317354
dir_list = os.listdir(path)
318-
if ImageNum>0:
319-
print('ok Back')
320-
ImageNum-=1
321-
img = PhotoImage(file=path+Final[ImageNum])
322-
if adjust_screenshot_size==True:
323-
img = img.zoom(2)
324-
img=img.subsample(3)
325-
canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img)
326-
canvas.create_image()
327-
else:
328-
ImageRelated()
355+
if Only_Return_True_if_there_is_an_image==False:
356+
if ImageNum>0:
357+
print('ok Back')
358+
ImageNum-=1
359+
img = PhotoImage(file=path+Final[ImageNum])
360+
if adjust_screenshot_size==True:
361+
img = img.zoom(2)
362+
img=img.subsample(3)
363+
canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img)
364+
canvas.create_image()
365+
else:
366+
ImageRelated()
367+
else:
368+
if ImageNum>0:
369+
return True
370+
329371
### End of ImageBack()
330372
######### Images #########
331373

@@ -392,13 +434,10 @@ def ImageBack():
392434
btn5 = Button(root, text =Language[6], activebackground=s_button_color_active,bg=s_button_color_unactive,fg=s_button_texte_color,height=s_button_height, width=s_button_width,borderwidth = 0,command =GitHubLink) #Bouton#// About
393435
btn5.pack(side='bottom')
394436

395-
btn7 = Button(root, text =Language[8], activebackground=s_button_color_active,bg=s_button_color_unactive,fg=s_button_texte_color,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageRelated) #Bouton#// About
396-
btn7.place(rely=0, relx=0, x=0, y=100,anchor=W)
397-
398-
btn8 = Button(root, text =Language[9], activebackground=s_button_color_active,bg=s_button_color_unactive,fg=s_button_texte_color,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageNext) #Bouton#// About
399-
btn8.place(rely=0, relx=0, x=0, y=150,anchor=W)
400-
401-
btn9 = Button(root, text =Language[10], activebackground=s_button_color_active,bg=s_button_color_unactive,fg=s_button_texte_color,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageBack) #Bouton#// About
437+
#btn7# (old place) now line 236 and after
438+
#btn8# (old place) now line 23. and after
439+
#btn9# Line 238 and after not working
440+
btn9 = Button(root, text =Language[10], activebackground=s_button_color_active,bg=s_button_color_unactive,fg=s_button_texte_color,height=s_button_height, width=s_button_width,borderwidth = 0,command =ImageBack) #Bouton#// Back Image
402441
btn9.place(rely=0, relx=0, x=0, y=200,anchor=W)
403442

404443
if super_mode==True:

settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
s_button_color_unactive="#525E70" #Couleur du BOUTON quand non cliqué #Default: #00CEFF CYAN
2222
s_button_color_active="#FFFFFF" #Couleur du BOUTON quand cliqué #Default: #E300FF VIOLET
2323
s_button_texte_color="#FFFFFF" #Couleur du texte BOUTON
24+
25+
s_button_texte_color_scr="#FFFFFF" #Couleur du texte BOUTON screenshot if found / Next if found / And back if found
26+
s_button_color_unactive_scr="#6D4AFF" #Couleur du BOUTON quand non cliqué.
27+
2428
s_button_font_size=12 #Taille texte police BOUTON
2529
s_button_font_family='Open Sans' #Type de police BOUTON
2630
s_button_height=2 #Hauteur du bouton

0 commit comments

Comments
 (0)