[Question] Little help with this app usiing COntainer #3004
Unanswered
rangergeronimo
asked this question in
Q&A
Replies: 1 comment
-
import flet as ft
words = {
"one": "1",
"two": "2",
"three": "3",
"four": "4",
"five": "5",
"six": "6",
"seven": "7",
"eight": "8",
"nine": "9",
"ten": "10",
}
def main(page: ft.Page):
page.title = "Containers - clickable and not"
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
def on_click(e) -> None:
e.control.content.value = words[e.control.content.value]
page.update()
page.update()
row = ft.Row(wrap=True, scroll="always", expand=True)
txt = ft.TextField
page.add(row)
for i in range(len(words.keys())):
for k in words.keys():
row.controls.append(
ft.Container(
content=txt(
value=k,
border_color="transparent",
border_width=0,
disabled=True,
),
margin=10,
padding=10,
alignment=ft.alignment.center,
bgcolor=ft.colors.CYAN_900,
width=150,
height=150,
border_radius=15,
ink=True,
on_click=on_click,
)
)
page.update()
if __name__ == "__main__":
ft.app(target=main) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Hello, I want to make a FLash Card app like using Flet,
the intended functionality is when user click on the car it should change to the mening of the word, both the word and its definitions come from a populated python dictionary;
SO far I haven't be able to do that the flash card update when user click on it.
below my code for suggenstion:

if name == "main":
ft.app(target=main)
Code sample
Error message
No response
------------------------------------------------------
Beta Was this translation helpful? Give feedback.
All reactions