flet
flet copied to clipboard
Scrolling in a tab isn't smooth in Windows
Using the latest pre release of Flet in Windows 10, scrolling with your middle mouse isn't smooth in a tab. Video below:
https://github.com/flet-dev/flet/assets/73901163/508ae350-8100-4ce6-b364-19c2ca941ee2
Example code:
def main(page: ft.Page):
page.window_resizable = False
page.window_width = 400
page.window_height = 300
text = ft.Text("Hello, world!")
container = ft.Container(
ft.Text("Container"),
alignment=ft.alignment.top_left,
col=ft.colors.BLACK,
height=400,
key="C",
)
text2 = ft.Text("Hello, world!")
col_content = ft.Column(controls=[text,container,text2], scroll=True)
tabs = ft.Tabs(
expand=1,
tabs=[
ft.Tab(
text="Example",
content=ft.Container(
content=col_content,
),
),
],
)
page.add(tabs)
ft.app(target=main)
To achieve smooth scrolling, the documentation suggests using ft.ListView https://flet.dev/docs/controls/listview/
@YouCantCMe
It was tested on Windows and Linux and it works fine. There is not enough data inside to scroll. Try it like this:
import flet as ft
def main(page: ft.Page):
page.window_resizable = False
page.window_width = 400
page.window_height = 300
text = ft.Text("Hello, world!")
container = ft.Container(
ft.Text("Container"),
alignment=ft.alignment.top_left,
bgcolor=ft.colors.BLACK38,
height=400,
key="C",
)
text2 = ft.Text("Hello, world!")
col_content = ft.Column(
controls=[
text,
text,
text,
text,
text,
text,
text,
text,
text,
text,
text,
text,
text,
text,
container,
text2],
scroll=ft.ScrollMode.ALWAYS
)
tabs = ft.Tabs(
expand=1,
tabs=[
ft.Tab(
text="Example",
content=ft.Container(
content=col_content,
),
),
],
)
page.add(tabs)
ft.app(target=main)
To achieve smooth scrolling, the documentation suggests using ft.ListView https://flet.dev/docs/controls/listview/
It still doesn't scroll smoothly using the middle mouse wheel with the provided example.
Hey, was anyone able to solve it? For me the scrolling is not smooth using the touch pad on my laptop (mouse), the normal mouse wheel works fine.