From d92a2a7c49bce803e3bce3314608b52f848730f3 Mon Sep 17 00:00:00 2001 From: superdimensional Date: Tue, 27 Apr 2021 22:40:29 -0400 Subject: [PATCH] moved functions to its own file --- ben10.py | 16 +--------------- functions.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 functions.py diff --git a/ben10.py b/ben10.py index ade7e29..56989bf 100644 --- a/ben10.py +++ b/ben10.py @@ -1,24 +1,10 @@ from tkinter import * from aliens import alien_table - +from functions import * root = Tk() root.title("Omnitrix") # root.attributes('-fullscreen', True) -counter= 0 - -def count_up(): - global counter - counter+= 1 - # print(counter) - -def count_down(): - global counter - counter-= 1 - # print(counter) - -def transform(): - print(alien_table(counter)) root.geometry("640x480") root.configure(bg="#70b607") diff --git a/functions.py b/functions.py new file mode 100644 index 0000000..5b5277a --- /dev/null +++ b/functions.py @@ -0,0 +1,21 @@ +from aliens import alien_table + +counter= 0 + +def count_up(): + global counter + counter+= 1 + # print(counter) + +def count_down(): + global counter + counter-= 1 + # print(counter) + +def transform(): + if counter < 0: + print(alien_table(counter * -1)) + elif counter == 0: + print(alien_table(counter)) + elif counter > 0: + print(alien_table(counter))