From 82bffd6caf37636f6948d3525f938a93bf5344ec Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Fri, 29 Dec 2023 20:43:49 +0100 Subject: [PATCH] Pi and deg2rad have to be defined if the script is imported too. --- physics/parabelfunc.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/physics/parabelfunc.py b/physics/parabelfunc.py index 5a38f84..7628362 100755 --- a/physics/parabelfunc.py +++ b/physics/parabelfunc.py @@ -7,6 +7,11 @@ from math import sin, cos, tan, sqrt from time import sleep +# pi is not defined by default +pi = 3.1416 +deg2rad = pi / 180 + + ######################################################################################## def berechneflugbahn(xmax, ymax, steps, startwinkel, startgeschwindigkeit, xmin=0, ymin=0, starthoehe=0, gravitation=9.81, xstep=1): x = 0 @@ -79,9 +84,7 @@ if __name__ == "__main__": cows = "🐵🐒🦍🦧🐕🐯🦝🐩🐅🐴🐎🦄🦌🐗🐂🐃🐄🐪🐫🦙🦒🐹🦘🦡🐧🕊️ 🦅🦆🦉🐍🦎🐊🦜🦚🦩🐲🐉🦕" cowlistlength = len(cows) cow = cows[random.randint(0, cowlistlength - 1)] - # pi is not defined by default - pi = 3.1416 - deg2rad = pi / 180 + # Needed: find our screensize. We are in textmode here termsize_xy = os.get_terminal_size()