[UPDATE] check default img
This commit is contained in:
parent
5792f214a7
commit
7325dfa122
BIN
data/emu/media/mame_bg.png
Normal file
BIN
data/emu/media/mame_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
BIN
media/nobg.png
Normal file
BIN
media/nobg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
BIN
media/noemu.png
Normal file
BIN
media/noemu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
69
start.py
69
start.py
@ -15,21 +15,68 @@ from modules.arrow import *
|
|||||||
from modules.emulateur_display import *
|
from modules.emulateur_display import *
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
sys.path.append( './modules/')
|
#sys.path.append( './modules/')
|
||||||
from arrow import *
|
#from arrow import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EmuMod = 1
|
||||||
|
RomMod = 0
|
||||||
|
|
||||||
|
|
||||||
|
#def EmuMod():
|
||||||
|
|
||||||
|
def BackgroundRom(Emu):
|
||||||
|
BgFile = "./data/emu/media/" + str(Emu) +"_bg.png"
|
||||||
|
BgFile = IsImgExist(BgFile,"bg")
|
||||||
|
BgEmu = PhotoImage(file = BgFile)
|
||||||
|
LabelBgEmu = Label(arkadeus,image=BgEmu)
|
||||||
|
LabelBgEmu.BgEmu = BgEmu
|
||||||
|
Cnv.create_image( 0, 0, image = BgEmu, anchor = "nw")
|
||||||
|
|
||||||
|
|
||||||
|
def IsImgExist(AbsPathFile,TypeMedia):
|
||||||
|
if not os.path.exists(AbsPathFile):
|
||||||
|
match TypeMedia:
|
||||||
|
case "emu":
|
||||||
|
return "./media/noemu.png"
|
||||||
|
case "bg":
|
||||||
|
return "./media/nobg.png"
|
||||||
|
else:
|
||||||
|
return AbsPathFile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def BackgroundEmu():
|
||||||
|
|
||||||
|
BackgroundEmu = Media["background"]
|
||||||
|
BgEmu = PhotoImage(file = Background)
|
||||||
|
LabelBgEmu = Label(arkadeus,image=BgEmu)
|
||||||
|
LabelBgEmu.BgEmu = BgEmu
|
||||||
|
Cnv.create_image( 0, 0, image = BgEmu, anchor = "nw")
|
||||||
|
|
||||||
def EnterEmu():
|
def EnterEmu():
|
||||||
|
EmuMod=0
|
||||||
|
RomMod=1
|
||||||
global cpt
|
global cpt
|
||||||
runMcpt = cpt + 1
|
runMcpt = cpt + 1
|
||||||
if runMcpt > EmuCpt:
|
if runMcpt > EmuCpt:
|
||||||
runMcpt = 0
|
runMcpt = 0
|
||||||
print("Emu : " + str(res[runMcpt]))
|
print("Emu : " + str(res[runMcpt]))
|
||||||
|
#Cnv.delete("all")
|
||||||
|
BackgroundRom(str(res[runMcpt]))
|
||||||
|
|
||||||
|
#def ParseEmu():
|
||||||
|
|
||||||
|
|
||||||
def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
|
def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
|
||||||
NfL="./data/emu/media/" + res[cL] + ".png"
|
NfL="./data/emu/media/" + res[cL] + ".png"
|
||||||
|
NfL = IsImgExist(NfL,"emu")
|
||||||
NfM="./data/emu/media/" + res[cM] + ".png"
|
NfM="./data/emu/media/" + res[cM] + ".png"
|
||||||
|
NfM = IsImgExist(NfM,"emu")
|
||||||
NfR="./data/emu/media/" + res[cR] + ".png"
|
NfR="./data/emu/media/" + res[cR] + ".png"
|
||||||
|
NfR = IsImgExist(NfR,"emu")
|
||||||
|
|
||||||
PNfL = PhotoImage(file = NfL)
|
PNfL = PhotoImage(file = NfL)
|
||||||
LabelPNfL = Label(arkadeus, image=PNfL)
|
LabelPNfL = Label(arkadeus, image=PNfL)
|
||||||
@ -53,12 +100,6 @@ def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
|
|||||||
Cnv.create_image(xR, yR, image=PNfR)
|
Cnv.create_image(xR, yR, image=PNfR)
|
||||||
print("Curent Emu : " + str(res[cM]))
|
print("Curent Emu : " + str(res[cM]))
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
#Cnv.pack(fill = "both", expand = True)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def leftKey():
|
def leftKey():
|
||||||
global cpt
|
global cpt
|
||||||
cpt = cpt - 1
|
cpt = cpt - 1
|
||||||
@ -148,14 +189,6 @@ else:
|
|||||||
|
|
||||||
print("res : " + str(Xsize) + ":" + str(Ysize) )
|
print("res : " + str(Xsize) + ":" + str(Ysize) )
|
||||||
|
|
||||||
bg = PhotoImage(file = Background)
|
|
||||||
|
|
||||||
Cnv = Canvas( arkadeus, width = Ysize , height = Xsize)
|
|
||||||
|
|
||||||
Cnv.pack(fill = "both", expand = True)
|
|
||||||
|
|
||||||
|
|
||||||
Cnv.create_image( 0, 0, image = bg, anchor = "nw")
|
|
||||||
|
|
||||||
|
|
||||||
MiddleSquareX=(Xsize/2)
|
MiddleSquareX=(Xsize/2)
|
||||||
@ -175,6 +208,10 @@ RightSquareY=(Ysize/3)
|
|||||||
RightSquareX2=RightSquareX + Square
|
RightSquareX2=RightSquareX + Square
|
||||||
RightSquareY2=RightSquareY + Square
|
RightSquareY2=RightSquareY + Square
|
||||||
|
|
||||||
|
Cnv = Canvas( arkadeus, width = Ysize , height = Xsize)
|
||||||
|
Cnv.pack(fill = "both", expand = True)
|
||||||
|
|
||||||
|
BackgroundEmu()
|
||||||
ViewEmu(cpt,LeftSquareX, LeftSquareY,cpt+1,MiddleSquareX, MiddleSquareY,cpt+2,RightSquareX, RightSquareY)
|
ViewEmu(cpt,LeftSquareX, LeftSquareY,cpt+1,MiddleSquareX, MiddleSquareY,cpt+2,RightSquareX, RightSquareY)
|
||||||
|
|
||||||
arkadeus.bind("<Left>", lambda event: leftKey())
|
arkadeus.bind("<Left>", lambda event: leftKey())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user