diff --git a/VRCT.py b/VRCT.py index bb1fd21e..d027e81b 100644 --- a/VRCT.py +++ b/VRCT.py @@ -411,6 +411,7 @@ class App(CTk): self.protocol("WM_DELETE_WINDOW", self.delete_window) self.config_window = ToplevelWindowConfig(self) + self.information_window = ToplevelWindowInformation(self) # start receive osc th_receive_osc_parameters = Thread(target=receive_osc_parameters, args=(self.check_osc_receive,)) @@ -441,8 +442,8 @@ class App(CTk): self.config_window.grab_set() def button_information_callback(self): - if self.information_window is None or not self.information_window.winfo_exists(): - self.information_window = ToplevelWindowInformation(self) + self.information_window.deiconify() + self.information_window.focus_set() self.information_window.focus() def checkbox_translation_callback(self): @@ -454,7 +455,6 @@ class App(CTk): print_textbox(self.textbox_message_log, "Stop translation", "INFO") print_textbox(self.textbox_message_system_log, "Stop translation", "INFO") - def transcription_send_start(self): self.mic_audio_queue = Queue() mic_device = [device for device in get_input_device_list()[self.CHOICE_MIC_HOST] if device["name"] == self.CHOICE_MIC_DEVICE][0] @@ -682,10 +682,11 @@ class App(CTk): print_textbox(self.textbox_message_system_log, "Start foreground", "INFO") def foreground_stop(self): - self.ENABLE_FOREGROUND = False - self.attributes("-topmost", False) - print_textbox(self.textbox_message_log, "Stop foreground", "INFO") - print_textbox(self.textbox_message_system_log, "Stop foreground", "INFO") + if self.ENABLE_FOREGROUND: + self.attributes("-topmost", False) + print_textbox(self.textbox_message_log, "Stop foreground", "INFO") + print_textbox(self.textbox_message_system_log, "Stop foreground", "INFO") + self.ENABLE_FOREGROUND = False def entry_message_box_press_key_enter(self, event): # send OSC typing diff --git a/window_information.py b/window_information.py index aa5d05a6..cc0d3b7f 100644 --- a/window_information.py +++ b/window_information.py @@ -4,6 +4,7 @@ from customtkinter import CTkToplevel, CTkTextbox, CTkFont class ToplevelWindowInformation(CTkToplevel): def __init__(self, parent, *args, **kwargs): super().__init__(parent, *args, **kwargs) + self.withdraw() self.parent = parent self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1) @@ -146,4 +147,8 @@ https://twitter.com/misya_ai """ self.textbox_information.insert("end", textbox_information_message) - self.textbox_information.configure(state='disabled') \ No newline at end of file + self.textbox_information.configure(state='disabled') + self.protocol("WM_DELETE_WINDOW", self.delete_window) + + def delete_window(self): + self.withdraw() \ No newline at end of file