Skip to content

Commit

Permalink
v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidden-Warden committed May 22, 2022
1 parent 697dc06 commit e21fcbe
Showing 1 changed file with 42 additions and 21 deletions.
63 changes: 42 additions & 21 deletions MyCards.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Version:
#0.5.0
#0.6.0
###
from ast import Num
import os ### Librairie
Expand Down Expand Up @@ -239,50 +239,71 @@ def ImageRelated():
global ListScrennshot
global ImageNum
global Activated
global Final
ListScrennshot=[]
ImageNum=0
Activated=True #Was the function called?
path = "Screenshots/"
dir_list = os.listdir(path)
##
for loop in range(len(dir_list)):
howmuch=dir_list[loop][3:4] # Get the number of the screenshot for the same word (0-9)
if howmuch=="-":
howmuch=dir_list[loop][4:5]
print(howmuch)

if dir_list[loop]==("#"+str(NumberOfWord)+"-"+howmuch+screenshot_type): # If the screenshot is the for the sale word
print("OK",("#"+str(NumberOfWord)+"-"+howmuch+screenshot_type))
ListScrennshot.append(("#"+str(NumberOfWord)+"-"+howmuch+screenshot_type))
print("How much",howmuch)
print("ListScrennshot",ListScrennshot)
print("num",NumberOfWord)
##
if ListScrennshot==[]:
for i in range(0,99):
try:
if NumberOfWord<=9:
if dir_list[i][2:3]=="-": #9
ListScrennshot.append(dir_list[i])
elif NumberOfWord>=10 and NumberOfWord<=99:
if dir_list[i][3:4]=="-": #10
ListScrennshot.append(dir_list[i])
elif NumberOfWord>=100 and NumberOfWord<=999:
if dir_list[i][4:5]=="-": #100
ListScrennshot.append(dir_list[i])
elif NumberOfWord>=1000:
if dir_list[i][5:6]=="-": #1000
ListScrennshot.append(dir_list[i])
except:
pass

print(ListScrennshot,"Liste des Screenshots")
Final=[]
Sample=[]
if ListScrennshot!=[]:
for u in range(0,99):
Sample.append(str("#"+str(NumberOfWord)+"-"+str(u)+screenshot_type))
print(Sample,"Sample")
for i in range(0,99):
for u in range(0,99):
try:
if Sample[i]==ListScrennshot[u]:
Final.append(Sample[i])
except:
pass
if Final==[]: #No screenshot was found
print("No screenshot for this word")
Activated=False
else:
print(path+ListScrennshot[0])
img = PhotoImage(file=path+ListScrennshot[0])
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
### End of ImageRelated()

def ImageNext():
global ImageNum
global Activated
if Activated==True:
path = "Screenshots/"
dir_list = os.listdir(path)
if len(ListScrennshot)>ImageNum+1:
if len(Final)>ImageNum+1:
print('ok Next')
ImageNum+=1
img = PhotoImage(file=path+ListScrennshot[ImageNum])
img = PhotoImage(file=path+Final[ImageNum])
if adjust_screenshot_size==True:
img = img.zoom(2)
img=img.subsample(3)
Expand All @@ -300,7 +321,7 @@ def ImageBack():
if ImageNum>0:
print('ok Back')
ImageNum-=1
img = PhotoImage(file=path+ListScrennshot[ImageNum])
img = PhotoImage(file=path+Final[ImageNum])
if adjust_screenshot_size==True:
img = img.zoom(2)
img=img.subsample(3)
Expand Down

0 comments on commit e21fcbe

Please sign in to comment.