diff --git a/cmdcompass/gui/global_tag.py b/cmdcompass/gui/global_tag.py index d084756..ad9dd65 100644 --- a/cmdcompass/gui/global_tag.py +++ b/cmdcompass/gui/global_tag.py @@ -7,19 +7,25 @@ class GlobalTagWindow(ctk.CTkToplevel): - def __init__(self, master, data_manager): + def __init__(self, master, data_manager,MainWindow_x,MainWindow_y): super().__init__(master) self.title("Create New Tag") - + screenSize = getScreenSize() tag_window_height = 800 tag_window_width = 270 - x = (screenSize["SCREEN_WIDTH"]*0.01) - y = (screenSize["SCREEN_HEIGHT"]/2) - (tag_window_height/2) + + + # Calculate the center position of the window + x = (screenSize["SCREEN_WIDTH"] / 3) - (tag_window_width/2) + MainWindow_x + y = (screenSize["SCREEN_HEIGHT"] / 3) - (tag_window_height/2) + MainWindow_y self.geometry('%dx%d+%d+%d' % (tag_window_width, tag_window_height, x, y)) - + + self.transient(master) + self.lift() + self.data_manager = data_manager # Main frame to hold everything @@ -137,4 +143,4 @@ def remove_tag(self, tag_uuid): self.data_manager.remove_tag(tag_uuid) self.update_tag_list() # Refresh the tag list except ValueError as e: - CTkMessagebox(title="Error", message=str(e), icon="cancel") + CTkMessagebox(title="Error", message=str(e), icon="cancel") \ No newline at end of file diff --git a/cmdcompass/gui/main_window.py b/cmdcompass/gui/main_window.py index 5f5dd07..f708131 100644 --- a/cmdcompass/gui/main_window.py +++ b/cmdcompass/gui/main_window.py @@ -267,7 +267,7 @@ def update_tab_button_states(self): self.comment_tab_button.configure(state="normal", fg_color=DEFAULT_BUTTON_COLOR) def open_tag_creation_window(self): - tag_creation_window = GlobalTagWindow(self, self.data_manager) + tag_creation_window = GlobalTagWindow(self, self.data_manager,self.winfo_x(),self.winfo_y()) tag_creation_window.grab_set() def open_add_tag_window(self, command):