Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window lose focus after close popup CTkMessageBox #69

Open
jackywu opened this issue Nov 25, 2024 · 0 comments
Open

window lose focus after close popup CTkMessageBox #69

jackywu opened this issue Nov 25, 2024 · 0 comments

Comments

@jackywu
Copy link

jackywu commented Nov 25, 2024

this is the new windows when I start my program.
image

this is the logo of my program in dock on macOS.
image

and I set a error parameter to raise CTkMessageBox

image

and I press "Ok" button to close the popup CTkMessageBox, the entry box could not be focused, and the logo become this
image

image

this is the code

class SettingFrame(ctk.CTkFrame):

    def save_settings(self) -> None:
        try:
            # Save duplicate download setting
            self.setting_manager.setting.allow_download_duplicates = self.allow_download_duplicates.get()

            # Save sleep time setting
            sleep_time = int(self.time_wait_scratch_entry.get())
            if sleep_time < 0:
                raise ValueError("间隔时间必须大于等于0")
            self.setting_manager.setting.time_wait_scratch = sleep_time

            # Save all settings to backend
            self.setting_manager.save_setting()
            CTkMessagebox(title="成功", message="所有设置已保存")

        except ValueError:
            CTkMessagebox(title="错误", message="请输入有效的整数作为间隔时间")

        except Exception as e:
            self._logger.exception(e)
            CTkMessagebox(title="错误", message=f"保存设置失败: {e}")

        self.master.focus_force()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant