From 9dd39204c3c37afcf7ad391eaaf12fea1685cd24 Mon Sep 17 00:00:00 2001 From: superdimensional Date: Fri, 30 Apr 2021 01:53:48 -0400 Subject: [PATCH] formated code/added comments --- .gitignore | 4 +++- ben10.py | 26 ++++++++++++++++---------- functions.py | 17 ++++++++--------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 9813357..a25d4b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ __pycache__/ -test.py \ No newline at end of file +test.py + +main.py \ No newline at end of file diff --git a/ben10.py b/ben10.py index 7769a3e..511cc49 100644 --- a/ben10.py +++ b/ben10.py @@ -1,34 +1,40 @@ from tkinter import * from aliens import alien_table from functions import * + root = Tk() - root.title("Omnitrix") -root.attributes('-fullscreen', True) - +# root.attributes('-fullscreen', True) root.geometry("640x480") root.configure(bg="#70b607") +# root window parameters + + +def button_press(): + transform() + omnitrix_button.config(image=PhotoImage(file="res/heatblast.png")) +# changes image omnitrix_screen = PhotoImage(file="res/omnitrix.png") - omnitrix_button = Button(root, image=omnitrix_screen, bg="#70b607", - activebackground='#70b607', highlightthickness=0, bd=0, command=transform) - + activebackground='#70b607', highlightthickness=0, bd=0, command=button_press) omnitrix_button.place(relx=0.5, rely=0.5, anchor=CENTER) - +# middle button omnitrix_left = Button(root, text="<", fg="white", bg="black", command=count_down, highlightthickness=0, bd=0, height=40, width=4) +omnitrix_left.pack(side="left") +# changes alien button (left) + omnitrix_right = Button(root, text=">", fg="white", bg="black", command=count_up, highlightthickness=0, bd=0, height=40, width=4) - -omnitrix_left.pack(side="left") omnitrix_right.pack(side="right") - +# changes alien button (right) quit_button = Button(root, text="X", fg="white", bg="black", command=root.destroy, highlightthickness=0, bd=0, width=7) quit_button.pack(side="bottom") +# kills program root.mainloop() diff --git a/functions.py b/functions.py index a5376ba..ad0d67e 100644 --- a/functions.py +++ b/functions.py @@ -1,16 +1,19 @@ from aliens import * -counter= 0 +counter = 0 + def count_up(): global counter - counter+= 1 - # print(counter) + counter += 1 + print(counter) + def count_down(): global counter - counter-= 1 - # print(counter) + counter -= 1 + print(counter) + def transform(): if counter < 0: @@ -19,7 +22,3 @@ def transform(): print(alien_table(counter)) elif counter > 0: print(alien_table(counter)) -# change_image(counter) - -# def change_image(counter): -# omnitrix_screen = PhotoImage(file= image_display(counter))