Skip to content

window lose focus after close popup CTkMessageBox  #69

@jackywu

Description

@jackywu

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions