diff --git a/MyCards.py b/MyCards.py index 32b4d46..4617bbf 100644 --- a/MyCards.py +++ b/MyCards.py @@ -1,5 +1,5 @@ #Version: -#0.8.0 +#0.9.0 ### import os ### Librairie #4 import csv ### .py & Librairie #5 @@ -229,10 +229,38 @@ def Update(Numéro): canvas.create_text((s_screen_width/scnd_colonne), (670), text=N7_2,fill=s_font_color, font=s_font_family) ##7 else: ##7 canvas.create_text((s_screen_width/scnd_colonne), (640), text=BaseDeMots[Numéro][7],fill=s_font_color, font=s_font_family) ##7 -#### + + ################################################################################################################################# + # Update color of screenshot button if screenshot is found + + if ImageRelated(Only_Return_True_if_there_is_an_image=True)==True: + 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 + 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 + else: + 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 + 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 + + ### + if ImageNext(Only_Return_True_if_there_is_an_image=True)==True: + 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 + 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 + else: + 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 + 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 + ### + """ #Not working + if ImageBack(Only_Return_True_if_there_is_an_image=True)==True: + 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 + btn9.place(rely=0, relx=0, x=0, y=200,anchor=W) + else: + 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 + btn9.place(rely=0, relx=0, x=0, y=200,anchor=W) + """ + +#### ######### Images ######### -def ImageRelated(): +def ImageRelated(Only_Return_True_if_there_is_an_image=False): global ListScrennshot global ImageNum global Activated @@ -280,52 +308,66 @@ def ImageRelated(): Activated=False print(Final,"Final") else: #If there is a screenshot - print('Found a screenshot for this word') - print(Final,"Final") - img = PhotoImage(file=path+Final[0]) - if adjust_screenshot_size==True: - img = img.zoom(2) - img=img.subsample(3) - canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, image=img) - canvas.create_image() - Activated=True - return Activated + if Only_Return_True_if_there_is_an_image==False: + print('Found a screenshot for this word') + print(Final,"Final") + img = PhotoImage(file=path+Final[0]) + if adjust_screenshot_size==True: + img = img.zoom(2) + img=img.subsample(3) + canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, image=img) + canvas.create_image() + Activated=True + return Activated + else: + return True ### End of ImageRelated() -def ImageNext(): +def ImageNext(Only_Return_True_if_there_is_an_image=False): global ImageNum global Activated if Activated==True: path = Screenshots_Folder_Path dir_list = os.listdir(path) - if len(Final)>ImageNum+1: - print('ok Next') - ImageNum+=1 - img = PhotoImage(file=path+Final[ImageNum]) - if adjust_screenshot_size==True: - img = img.zoom(2) - img=img.subsample(3) - canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img) - canvas.create_image() + if Only_Return_True_if_there_is_an_image==False: + if len(Final)>ImageNum+1: + print('ok Next') + ImageNum+=1 + img = PhotoImage(file=path+Final[ImageNum]) + if adjust_screenshot_size==True: + img = img.zoom(2) + img=img.subsample(3) + canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img) + canvas.create_image() + else: + ImageRelated() else: - ImageRelated() + if len(Final)>ImageNum+1: + return True + else: + return False ### End of ImageNext() -def ImageBack(): +def ImageBack(Only_Return_True_if_there_is_an_image=False): global ImageNum global Activated if Activated==True: path = Screenshots_Folder_Path dir_list = os.listdir(path) - if ImageNum>0: - print('ok Back') - ImageNum-=1 - img = PhotoImage(file=path+Final[ImageNum]) - if adjust_screenshot_size==True: - img = img.zoom(2) - img=img.subsample(3) - canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img) - canvas.create_image() - else: - ImageRelated() + if Only_Return_True_if_there_is_an_image==False: + if ImageNum>0: + print('ok Back') + ImageNum-=1 + img = PhotoImage(file=path+Final[ImageNum]) + if adjust_screenshot_size==True: + img = img.zoom(2) + img=img.subsample(3) + canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img) + canvas.create_image() + else: + ImageRelated() + else: + if ImageNum>0: + return True + ### End of ImageBack() ######### Images ######### @@ -392,13 +434,10 @@ def ImageBack(): 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 btn5.pack(side='bottom') -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 -btn7.place(rely=0, relx=0, x=0, y=100,anchor=W) - -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 -btn8.place(rely=0, relx=0, x=0, y=150,anchor=W) - -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 +#btn7# (old place) now line 236 and after +#btn8# (old place) now line 23. and after +#btn9# Line 238 and after not working +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 btn9.place(rely=0, relx=0, x=0, y=200,anchor=W) if super_mode==True: diff --git a/settings.py b/settings.py index e1ea2ce..2ce3288 100644 --- a/settings.py +++ b/settings.py @@ -21,6 +21,10 @@ s_button_color_unactive="#525E70" #Couleur du BOUTON quand non cliqué #Default: #00CEFF CYAN s_button_color_active="#FFFFFF" #Couleur du BOUTON quand cliqué #Default: #E300FF VIOLET s_button_texte_color="#FFFFFF" #Couleur du texte BOUTON + +s_button_texte_color_scr="#FFFFFF" #Couleur du texte BOUTON screenshot if found / Next if found / And back if found +s_button_color_unactive_scr="#6D4AFF" #Couleur du BOUTON quand non cliqué. + s_button_font_size=12 #Taille texte police BOUTON s_button_font_family='Open Sans' #Type de police BOUTON s_button_height=2 #Hauteur du bouton