flet: работает только одна кнопка
Работает лишь одна из кнопок. Сделал примерный код с кнопками и страницами, куда они должны вести. Работает только третья кнопка
from flet import *
def main_o(page: Page):
page.title = "TestProject"
page.theme_mode = 'light'
page.vertical_alignment = MainAxisAlignment
page.horizontal_alignment = CrossAxisAlignment
page.window_width = 385
page.window_height = 660
page.padding = 0
BG = '#FFFFFF'
ScrollbarTheme = 'dark'
wallet_page = Row(
[
Column(
[
Text("Soon...")
],
horizontal_alignment=CrossAxisAlignment.CENTER
),
],
alignment=MainAxisAlignment.CENTER,
)
award_page = Row(
[
Column(
[
Text("Soon...")
],
horizontal_alignment=CrossAxisAlignment.CENTER
),
],
alignment=MainAxisAlignment.CENTER,
)
Equip_page = Row(
[
Column(
[
Text("Soon...")
],
horizontal_alignment=CrossAxisAlignment.CENTER
),
],
alignment=MainAxisAlignment.CENTER,
)
climb_page = Row(
[
Column(
[
Text("Soon...")
],
horizontal_alignment=CrossAxisAlignment.CENTER
),
],
alignment=MainAxisAlignment.CENTER,
)
def openpage1(e):
page.clean()
page.add(award_page)
def openpage2(e):
page.clean()
page.add(Equip_page)
def openpage3(e):
page.clean()
page.add(climb_page)
def openpage4(e):
page.clean()
page.add(wallet_page)
main_page = Container(
Stack([
Image(
src='/images/bg.png',
),
Container(
width=385,
height=650,
# opacity=0.5,
# bgcolor= BG,
padding=padding.only(left=0, right=274, top=420, bottom=0),
border_radius=10,
content=Row(
alignment=MainAxisAlignment.CENTER,
controls=[
ElevatedButton(
on_click=openpage1,
width=50,
height=50,
opacity=0.3,
),
],
),
),
Container(
width=385,
height=650,
# opacity=0.5,
# bgcolor= BG,
padding=padding.only(left=0, right=136, top=420, bottom=0),
border_radius=10,
content=Row(
alignment=MainAxisAlignment.CENTER,
controls=[
ElevatedButton(
on_click=openpage2,
width=50,
height=50,
opacity=0.3,
),
],
),
),
# Container(
# width=385,
# height=650,
# # opacity=0.5,
# # bgcolor= BG,
# padding=padding.only(left=0, right=0, top=420, bottom=0),
# border_radius=10,
# content=Row(
# alignment=MainAxisAlignment.CENTER,
# controls=[
# ElevatedButton(
# on_click=openpage,
# width=50,
# height=50,
# opacity=0.3,
# ),
# ],
# ),
# ),
Container(
width=385,
height=650,
# opacity=0.5,
# bgcolor= BG,
padding=padding.only(left=274, right=0, top=420, bottom=0),
border_radius=10,
content=Row(
alignment=MainAxisAlignment.CENTER,
controls=[
ElevatedButton(
on_click=openpage3,
width=50,
height=50,
opacity=0.3,
),
],
),
),
Container(
width=385,
height=650,
# opacity=0.5,
# bgcolor= BG,
padding=padding.only(left=136, right=0, top=420, bottom=0),
border_radius=10,
content=Row(
alignment=MainAxisAlignment.CENTER,
controls=[
ElevatedButton(
on_click=openpage4,
width=50,
height=50,
opacity=0.3,
),
],
),
),
])
)
page.add(main_page)
app(target=main_o, assets_dir='assets')