-
Notifications
You must be signed in to change notification settings - Fork 624
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
This issue only occurs under the following stringent conditions:
- The working directory is in the root directory of a classic project created by
flet create(withsrcas its subdirectory); flet build windowsmust have been run at least once (other platforms have not been tested), and a build folder must have been generated in the root directory.
In short: When the above conditions are met, ft.PageView control will not display correctly and will be replaced with the error message described in the title.
Also noteworthy is the unusual change in the display window title: it is now the name of the project folder instead of the usual Flet.
Code sample
Code
import flet as ft
def main(page: ft.Page):
page.padding = 0
page.add(
ft.PageView(
expand=True,
viewport_fraction=0.9,
on_change=lambda e: print(f"Currently viewing page {int(e.data)}"),
selected_index=1,
horizontal=True,
controls=[
ft.Container(
bgcolor=ft.Colors.INDIGO_400,
content=ft.Column(
alignment=ft.MainAxisAlignment.CENTER,
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
controls=[
ft.Text("Welcome", size=40, weight=ft.FontWeight.BOLD),
ft.Text("Swipe to see what PageView can do."),
],
),
),
ft.Container(
bgcolor=ft.Colors.PINK_300,
content=ft.Column(
alignment=ft.MainAxisAlignment.CENTER,
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
controls=[
ft.Icon(ft.Icons.ANIMATION, size=72),
ft.Text(
"Viewport fraction lets you peek at the next slide."
),
],
),
),
ft.Container(
bgcolor=ft.Colors.TEAL_300,
content=ft.Column(
alignment=ft.MainAxisAlignment.CENTER,
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
controls=[
ft.Icon(ft.Icons.TOUCH_APP, size=72),
ft.Text("Use on_change to respond to page swipes."),
],
),
),
],
),
)
if __name__ == "__main__":
ft.run(main)To reproduce
The following steps can reliably reproduce this issue.
- Create a folder that can use any common name; here, we specify
test. - Create a virtual environment at
.venv. This example usesuvto create virtual environments and manage packages. - Run
flet create. Then editpyproject.tomland add the following line:
[tool.uv]
prerelease = "allow"
- Run
uv sync --upgrade. - Create
test.py. The content is consistent with the sample code provided in this issue, and it is also obtained from the official documentation. The location of this file will not affect the final result. - Run
test.pyfrom the project root directory. It should be able to work normally at this time. - Run
flet build windows. - Run
test.pyagain. The aforementioned error will now be observed, and the window title will also change to the name of the project folder.
Expected behavior
PageView displays correctly
Screenshots / Videos
Operating System
Windows
Operating system details
Windows 11 (26200.7840)
Flet version
0.80.6.dev7651
Regression
No, it isn't
Suggestions
No response
Logs
Logs
[Paste your logs here]Additional details
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
