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

page.window.right #4730

Open
1 task done
SKD8 opened this issue Jan 17, 2025 · 1 comment
Open
1 task done

page.window.right #4730

SKD8 opened this issue Jan 17, 2025 · 1 comment

Comments

@SKD8
Copy link

SKD8 commented Jan 17, 2025

Duplicate Check

Describe the requested feature

I want to keep my window on the left or to the right based on a condition. and it's hard to get the maximum width of the display. So what if we have page.window.right? It will be way easier if we have the have page.window.right

import flet as ft
async def main(page: ft.Page):
     max_width = 1280 #Assumed 
     async def check_window_position():
         nonlocal max_width
        while True:
            if page.window.top > 0 and page.window.bgcolor == ft.colors.TRANSPARENT:
                if page.window.left < max_width/2:
                    page.window.left = 0
                    page.update()
                else:
                    page.window.left = max_width-10
                    page.update()
            await asyncio.sleep(0.1)  # Check every 100ms
    asyncio.create_task(check_window_position())
page.add(ft.Text(""))
ft.app(main)

Screenshots

No response

Additional details

No response

@OwenMcDonnell
Copy link
Contributor

Can you please properly format your code sample using markdown like this.

```python
<your properly indented code here>
```

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

2 participants