From d46760540101e7a3c4d14031065ea07efa95da67 Mon Sep 17 00:00:00 2001 From: superdimensional Date: Sat, 1 May 2021 19:11:47 -0400 Subject: [PATCH] skip functionallity added --- aliens.py | 4 ++-- ben10.py | 15 ++++++++------- functions.py | 26 +++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/aliens.py b/aliens.py index 09d38eb..a8f2aa8 100644 --- a/aliens.py +++ b/aliens.py @@ -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") diff --git a/ben10.py b/ben10.py index 47b0d2b..0c4bfb8 100644 --- a/ben10.py +++ b/ben10.py @@ -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 diff --git a/functions.py b/functions.py index b2069b5..c3b3b39 100644 --- a/functions.py +++ b/functions.py @@ -36,4 +36,28 @@ def button_press(): print(alien_table(counter)) elif counter > 0: print(alien_table(counter)) -# ! replace with sound playing function \ No newline at end of file +# ! 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! \ No newline at end of file