I have a simple Python script:
import flet as fl
def main(page:fl.Page):
def print_values(e):
for input_value in column.controls:print(input_value)
column=fl.Column(controls=[fl.TextField() for n in range(5)])
button=fl.ElevatedButton('PRINT',on_click=print_values)
page.add(column,button)
fl.app(target=main)
I add to the page some Textfields
, using a for
-loop. How can I print their values after the input? I suppose those are the column's children.
Edited a bit, and I get this:
textfield {'value': 'homer'}
textfield {'value': 'bart'}
textfield {'value': 'marge'}
textfield {'value': 'maggie'}
textfield {'value': 'lisa'}
Solved:
for input_value in column.controls:print(input_value.value)