From 9b4005422bc2f87f8f48c4c0b6c9d3a7a7e5a1f1 Mon Sep 17 00:00:00 2001 From: Klemek Date: Sun, 19 Apr 2020 16:22:21 +0200 Subject: [PATCH] templates edit tools --- tools/__init__.py | 0 tools/calc.py | 19 +++++++++++++++++++ {templates => tools}/live_edit.py | 0 3 files changed, 19 insertions(+) create mode 100644 tools/__init__.py create mode 100644 tools/calc.py rename {templates => tools}/live_edit.py (100%) diff --git a/tools/__init__.py b/tools/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tools/calc.py b/tools/calc.py new file mode 100644 index 0000000..9182698 --- /dev/null +++ b/tools/calc.py @@ -0,0 +1,19 @@ +try: + while True: + w = int(input("width:")) + h = int(input("height:")) + try: + while True: + x0 = int(input("x0:")) + y0 = int(input("y0:")) + w1 = int(input("w1:")) + h1 = int(input("h1:")) + x1 = round(x0/w, 2) + y1 = round(y0/h, 2) + x2 = round((x0+w1)/w, 2) + y2 = round((y0+h1)/h, 2) + print(',{\n "x_range": '+f"[{x1:.2f}, {x2:.2f}]"+',\n "y_range": '+f"[{y1:.2f}, {y2:.2f}]"+'\n }') + except: + pass +except: + pass \ No newline at end of file diff --git a/templates/live_edit.py b/tools/live_edit.py similarity index 100% rename from templates/live_edit.py rename to tools/live_edit.py