skip functionallity added
This commit is contained in:
parent
7f20b772eb
commit
d467605401
3 changed files with 35 additions and 10 deletions
|
@ -3,7 +3,7 @@ def alien_table(index):
|
||||||
return {
|
return {
|
||||||
|
|
||||||
0: "OFF",
|
0: "OFF",
|
||||||
1: "Cannonbolt",
|
1: "Heatblast",
|
||||||
2: "Ripjaws",
|
2: "Ripjaws",
|
||||||
3: "Diamondhead",
|
3: "Diamondhead",
|
||||||
4: "Stinkfly",
|
4: "Stinkfly",
|
||||||
|
@ -14,7 +14,7 @@ def alien_table(index):
|
||||||
9: "Wildmutt",
|
9: "Wildmutt",
|
||||||
10: "Ghostfreak",
|
10: "Ghostfreak",
|
||||||
11: "Wildvine",
|
11: "Wildvine",
|
||||||
12: "Heatblast",
|
12: "Cannonbolt",
|
||||||
# TODO: Add more aliens
|
# TODO: Add more aliens
|
||||||
}.get(index, "ERROR")
|
}.get(index, "ERROR")
|
||||||
|
|
||||||
|
|
15
ben10.py
15
ben10.py
|
@ -5,11 +5,12 @@ from PIL import ImageTk, Image
|
||||||
|
|
||||||
root = Tk()
|
root = Tk()
|
||||||
root.title("Omnitrix")
|
root.title("Omnitrix")
|
||||||
root.attributes('-fullscreen', True)
|
# root.attributes('-fullscreen', True)
|
||||||
root.geometry("640x480")
|
root.geometry("640x480")
|
||||||
root.configure(bg="#70b607")
|
root.configure(bg="#70b607")
|
||||||
root.columnconfigure(1, weight=1)
|
root.columnconfigure(1, weight=1)
|
||||||
root.rowconfigure(1, weight=1)
|
root.rowconfigure(1, weight=1)
|
||||||
|
|
||||||
# root window parameters
|
# root window parameters
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,16 +20,16 @@ omnitrix_button = Button(root, bg="#70b607", image=img, activebackground='#70b60
|
||||||
highlightthickness=0, bd=0, command=button_press)
|
highlightthickness=0, bd=0, command=button_press)
|
||||||
# TODO: make sound when pressed
|
# TODO: make sound when pressed
|
||||||
omnitrix_button.image = img
|
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
|
# 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)
|
highlightthickness=0, bd=0, height=5, width=4)
|
||||||
omnitrix_left_skip.grid(column=0, row=0)
|
omnitrix_left_skip.grid(column=0, row=0)
|
||||||
# bulk skip left button
|
# 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)
|
highlightthickness=0, bd=0, height=5, width=4)
|
||||||
omnitrix_right_skip.grid(column=3, row=0)
|
omnitrix_right_skip.grid(column=3, row=0)
|
||||||
# bulk skip right button
|
# 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)
|
quit_button.grid(column=1, row=3, columnspan=2)
|
||||||
# kills program
|
# kills program
|
||||||
|
|
||||||
change_entry = Entry(root, fg="black", bg="white",
|
# change_entry = Entry(root, fg="black", bg="white",
|
||||||
highlightthickness=0, bd=0, width=5)
|
# highlightthickness=0, bd=0, width=5)
|
||||||
change_entry.grid(column=1, row=0, columnspan=2)
|
# change_entry.grid(column=1, row=0, columnspan=2)
|
||||||
# change to specific entry
|
# change to specific entry
|
||||||
|
|
||||||
|
|
||||||
|
|
24
functions.py
24
functions.py
|
@ -37,3 +37,27 @@ def button_press():
|
||||||
elif counter > 0:
|
elif counter > 0:
|
||||||
print(alien_table(counter))
|
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!
|
Loading…
Add table
Reference in a new issue