Skip to content

Commit

Permalink
v0.9.0
Browse files Browse the repository at this point in the history
Updated: Screenshot button & Next button (Screenshot)
  • Loading branch information
Hidden-Warden committed Apr 30, 2023
1 parent 724a5da commit 6f272fb
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 43 deletions.
125 changes: 82 additions & 43 deletions MyCards.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Version:
#0.8.0
#0.9.0
###
import os ### Librairie #4
import csv ### .py & Librairie #5
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 #########

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f272fb

Please sign in to comment.