From 0f1d2922b35ce4ebe685a33307857ce3bab9e528 Mon Sep 17 00:00:00 2001 From: okraska-kropidlowski Date: Mon, 30 Oct 2023 00:42:48 +0100 Subject: [PATCH] Clear entry after profile is added --- profiles.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/profiles.py b/profiles.py index 0464ff4..201859c 100644 --- a/profiles.py +++ b/profiles.py @@ -17,6 +17,7 @@ #Functions definition def add_profile(): + global profiles_file_content new_profile = add_profile_box.get() if len(new_profile) > 16: new_profile = new_profile[:16] @@ -28,14 +29,17 @@ def add_profile(): with open('data/profiles_list', "a") as profiles_file: if profiles_file_content == '': profiles_file.write(new_profile) - profiles.destroy() + add_profile_box.delete(0, tkinter.END) + return elif not profiles_file_content.endswith('\n'): profiles_file.write('\n') profiles_file.write(new_profile) - profiles.destroy() + add_profile_box.delete(0, tkinter.END) + return elif profiles_file_content.endswith('\n'): profiles_file.write(new_profile) - profiles.destroy() + add_profile_box.delete(0, tkinter.END) + return def profile_name_check(profile_entry): if (profile_entry.isalnum() or profile_entry in ['_', '-']):