From a39851bb61156def4c20e2abca07c18c1641a7e8 Mon Sep 17 00:00:00 2001 From: Looki2000 Date: Sat, 16 Mar 2024 22:00:41 +0100 Subject: [PATCH] small changes to guide lines --- .gitignore | 2 +- main.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 6052bb9..2bcfea4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,6 @@ __pycache__/ .vscode/ last_path_cache.txt -grid_values.txt +guide_values.txt *.fontproj \ No newline at end of file diff --git a/main.py b/main.py index c356cf8..d713996 100644 --- a/main.py +++ b/main.py @@ -279,10 +279,10 @@ entry_3.pack(side="top", pady=2) ## load last values cwd = os.path.dirname(os.path.realpath(__file__)) -grid_vals_path = os.path.join(cwd, "grid_values.txt") +guide_vals_path = os.path.join(cwd, "guide_values.txt") -def get_grid_entries(): +def get_guide_entries(): return ( int(entry_1.get()), int(entry_2.get()), @@ -296,31 +296,31 @@ def update_guide_pos(pos, dont_save=False): if dont_save: return - with open(grid_vals_path, "w") as f: + with open(guide_vals_path, "w") as f: f.write(f"{entry_1.get()}\n{entry_2.get()}\n{entry_3.get()}") -if os.path.exists(grid_vals_path): - with open(grid_vals_path, "r") as f: +if os.path.exists(guide_vals_path): + with open(guide_vals_path, "r") as f: lines = f.readlines() entry_1.insert(0, lines[0].strip()) entry_2.insert(0, lines[1].strip()) entry_3.insert(0, lines[2].strip()) - update_guide_pos(get_grid_entries(), dont_save=True) + update_guide_pos(get_guide_entries(), dont_save=True) else: - entry_1.insert(0, "2") - entry_2.insert(0, "4") - entry_3.insert(0, "10") + entry_1.insert(0, str(3)) + entry_2.insert(0, str(5)) + entry_3.insert(0, str(10)) - update_guide_pos(get_grid_entries()) + update_guide_pos(get_guide_entries()) set_button = tkinter.Button( frame_label_guide_pos, text="Set", - command=lambda: update_guide_pos(get_grid_entries()) + command=lambda: update_guide_pos(get_guide_entries()) ).pack(side="top", pady=[5, 30])