Skip to content

v1: Programmatically minimizing the window only works first time #5572

@oussama-gourari

Description

@oussama-gourari

Duplicate Check

Describe the bug

When trying to implement a button to minimize the window programmatically, it works for the first time only, bringing back the window up from the task bar and trying to minimize it again using the button does not work.

Code sample

Code
import flet as ft


def main(page: ft.Page):

    def minimize():
        page.window.minimized = True

    page.add(
        ft.Button(
            content="Minimize",
            on_click=minimize,
        ),
    )


ft.run(main)

To reproduce

  1. Run the sample code.
  2. Click the custom "Minimize" button (Window should minimize as expected).
  3. Bring back up the window by clicking it on the task bar.
  4. Click the custom "Minimize" button again (No longer has effect).

Expected behavior

No response

Screenshots / Videos

Captures

Operating System

Linux

Operating system details

Manjaro Linux x86_64

Flet version

0.70.0.dev5463

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions