skip functionallity added

This commit is contained in:
superdimensional 2021-05-01 19:11:47 -04:00
parent 7f20b772eb
commit d467605401
3 changed files with 35 additions and 10 deletions

View file

@ -3,7 +3,7 @@ def alien_table(index):
return {
0: "OFF",
1: "Cannonbolt",
1: "Heatblast",
2: "Ripjaws",
3: "Diamondhead",
4: "Stinkfly",
@ -14,7 +14,7 @@ def alien_table(index):
9: "Wildmutt",
10: "Ghostfreak",
11: "Wildvine",
12: "Heatblast",
12: "Cannonbolt",
# TODO: Add more aliens
}.get(index, "ERROR")

View file

@ -5,11 +5,12 @@ from PIL import ImageTk, Image
root = Tk()
root.title("Omnitrix")
root.attributes('-fullscreen', True)
# root.attributes('-fullscreen', True)
root.geometry("640x480")
root.configure(bg="#70b607")
root.columnconfigure(1, weight=1)
root.rowconfigure(1, weight=1)
# root window parameters
@ -19,16 +20,16 @@ omnitrix_button = Button(root, bg="#70b607", image=img, activebackground='#70b60
highlightthickness=0, bd=0, command=button_press)
# TODO: make sound when pressed
omnitrix_button.image = img
omnitrix_button.grid(column=1, row=1, rowspan=2, columnspan=2)
omnitrix_button.grid(column=1, row=0, rowspan=3, columnspan=2)
# middle button
omnitrix_left_skip = Button(root, text="<<<", fg="white", bg="black",
omnitrix_left_skip = Button(root, text="<<<", fg="white", bg="black", command=lambda: skip_down(omnitrix_button),
highlightthickness=0, bd=0, height=5, width=4)
omnitrix_left_skip.grid(column=0, row=0)
# bulk skip left button
omnitrix_right_skip = Button(root, text=">>>", fg="white", bg="black",
omnitrix_right_skip = Button(root, text=">>>", fg="white", bg="black", command=lambda: skip_up(omnitrix_button),
highlightthickness=0, bd=0, height=5, width=4)
omnitrix_right_skip.grid(column=3, row=0)
# bulk skip right button
@ -50,9 +51,9 @@ quit_button = Button(root, text="X", fg="white", bg="black",
quit_button.grid(column=1, row=3, columnspan=2)
# kills program
change_entry = Entry(root, fg="black", bg="white",
highlightthickness=0, bd=0, width=5)
change_entry.grid(column=1, row=0, columnspan=2)
# change_entry = Entry(root, fg="black", bg="white",
# highlightthickness=0, bd=0, width=5)
# change_entry.grid(column=1, row=0, columnspan=2)
# change to specific entry

View file

@ -36,4 +36,28 @@ def button_press():
print(alien_table(counter))
elif counter > 0:
print(alien_table(counter))
# ! replace with sound playing function
# ! replace with sound playing function
def skip_up(omnitrix_button):
global counter
counter += 5
print(counter)
if counter < 0:
path = image_display(counter * -1)
else:
path = image_display(counter)
img = ImageTk.PhotoImage(Image.open(path))
omnitrix_button.configure(image=img)
omnitrix_button.image = img # keep a reference!
def skip_down(omnitrix_button):
global counter
counter -= 5
print(counter)
if counter < 0:
path = image_display(counter * -1)
else:
path = image_display(counter)
img = ImageTk.PhotoImage(Image.open(path))
omnitrix_button.configure(image=img)
omnitrix_button.image = img # keep a reference!