flet-dev / flet-dev/flet

When two monitors are used, page.window_center () is displayed in the wrong position

Open
#2,390 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: awaiting response
Dominant language
Python
Stars
17k
Forks
694
Avg merge
1d 14h
Merged PRs (30d)
33

Description

Description

I have two monitors in use, and the resolution of the two monitors is not the same, the left is 2560x1440, the right is 1920x1080, page.window_center () is displayed in the wrong position, it is displayed on the right side of the monitor, but only the left side of the program window is displayed

Code example to reproduce the issue:

# -*- coding: utf-8 -*-

import flet as ft

def main(page: ft.Page):
    page.add(ft.Text('hello'))
    page.window_center()
    page.update()

if __name__ == "__main__":
    ft.app(target=main)

Describe the results you received:

image

Describe the results you expected:

image

Additional information you deem important (e.g. issue happens only occasionally):

Flet version (pip show flet):

Name: flet
Version: 0.18.0
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page:
Author: Appveyor Systems Inc.
Author-email: hello@flet.dev
License: Apache-2.0
Location: C:\Python311\venv311\Lib\site-packages
Requires: cookiecutter, flet-runtime, packaging, qrcode, watchdog, websocket-client, websockets
Required-by:

Operating system:

windows 11

Additional environment details:
attention: the resolution of the two monitors is not the same, the left is 2560x1440, the right is 1920x1080

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Python reproduction using page.window_center() and run it on Windows 11 with two monitors at the reported resolutions. Trace the page.window_center() implementation and compare the calculated position with the expected centered location; done means the window is centered correctly on the intended monitor.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.