Skip to content

Commit

Permalink
v0.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidden-Warden committed May 21, 2022
1 parent 3753c29 commit 4399678
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
__pycache__/
Other/
MyCards_Updater/
Screenshots/
ImageGit/
43 changes: 31 additions & 12 deletions MyCards.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#Version:
#0.4.3
#0.4.5
###
import os ### Librairie
import csv ### Docs / Librairie
import csv ### .py & Librairie
import random ### Librairie
import webbrowser ### Librairie
import tkinter.font as font
from tkinter import * ### Librairie
from settings import * ### Docs
from language_modules import * ### Docs
from settings import * ### .py
from language_modules import * ### .py
###
Language=[] #List (will contain the words)
NumberOfWord=-1 #The number of the word in the list (DataBase.csv)
Expand Down Expand Up @@ -85,6 +85,7 @@ def GitHubLink():
if True:
webbrowser.open(GitHub)
### Keyborad shortcuts

def Randm(x):
Randow_Word()
def Nxt(x):
Expand All @@ -93,6 +94,13 @@ def Bck(x):
Back()
def Escp(x):
root.destroy()
def IMG_related(x):
ImageRelated()
def IMG_Next(x):
ImageNext()
def IMG_Back(x):
ImageBack()

###
def Update(Numéro):
# Update the window content with the new word
Expand Down Expand Up @@ -217,7 +225,7 @@ def Update(Numéro):
print("Directory already created")
#End

#########
######### Images #########
def ImageRelated():
global ListScrennshot
global ImageNum
Expand All @@ -241,13 +249,14 @@ def ImageRelated():
print(path+ListScrennshot[0])
img = PhotoImage(file=path+ListScrennshot[0])
print('Found a screenshot for this word')
#
canvas2=canvas.create_image(s_screen_width/3,s_screen_height/3, anchor=CENTER, image=img)
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


def ImageNext():
global ImageNum
global Activated
Expand All @@ -257,7 +266,10 @@ def ImageNext():
if len(ListScrennshot)>ImageNum+1:
print('ok Next')
ImageNum+=1
img = PhotoImage(file=path+ListScrennshot[ImageNum])
img = PhotoImage(file=path+ListScrennshot[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:
Expand All @@ -272,12 +284,15 @@ def ImageBack():
if ImageNum>0:
print('ok Back')
ImageNum-=1
img = PhotoImage(file=path+ListScrennshot[ImageNum])
img = PhotoImage(file=path+ListScrennshot[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()
#########
######### Images #########

###
root = Tk()
Expand Down Expand Up @@ -341,14 +356,18 @@ def ImageBack():
canvas= Canvas(root, width=s_screen_width, height=s_screen_height, bg=s_zone_texte,highlightthickness=3, highlightbackground=s_contour_zone_texte) #Texte
canvas2=Canvas(root, width=s_screen_width, height=s_screen_height) #Image
canvas.pack()

###

####End of the function Update####
root.bind("<space>",Randm) #Space BAR
root.bind("<Left>",Bck) #Left Arrow
root.bind("<Right>",Nxt) #Right Arrow
root.bind("<Escape>",Escp) #Echap / Escape

root.bind("<b>",IMG_related) #Image Related ?
root.bind("<n>",IMG_Next) #Image Next
root.bind("<v>",IMG_Back) #Image Back

###
Next() #Show the first card at launch.
root.mainloop()
4 changes: 2 additions & 2 deletions language_modules.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FR=["Suivant","Retour","Mot aléatoire","Quitter","Menu","Paramètres","À propos","Image(s) Lié","Suivant","Retour"]
EN=["Next","Back","Random word","Quit","Menu","Settings","About","Update CSV","Image(s) Related","Next","Back"]
FR=["Suivant","Retour","Mot aléatoire","Quitter","Menu","Paramètres","À propos","Capture d'écrant","Suivant","Retour"]
EN=["Next","Back","Random word","Quit","Menu","Settings","About","Update CSV","Screenshot","Next","Back"]
4 changes: 3 additions & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
reseizeable_windows=True #True(Resizeable windows), False(Fixed windows)
s_delimiter=";" #Delimiter used in the CSV file (";" / ",")
screenshot_type=".png" #Type of screenshot (".png" / ".jpg")
adjust_screenshot_size=True #True(Adjust screenshot size) to the frame, False(Keep original size)


first_colonne=5 #The higher the value, the more to the left
scnd_colonne=2.2 #The higher the value, the more to the left
Expand All @@ -22,7 +24,7 @@
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
s_button_width=13 #Largeur du bouton
s_button_width=12 #Largeur du bouton

#In test#
data_base_free_category=False #True(Shown), False(Hidden)
Expand Down

0 comments on commit 4399678

Please sign in to comment.