In a Python3-Flet script I have a Column, with various controls (Dropdown, Textfields, Button) and I need to print only TextFields's values. This is my script:
from flet import *
def main(page:Page):
def print_only_textfields(e):
for textfield in column.controls:print(textfield)
column=Column(controls=[Dropdown(value='dropdown'),
TextField(value='text1'),
TextField(value='text2'),
ElevatedButton('PRINT',on_click=print_only_textfields)])
page.add(column)
app(target=main)
This is what I get:
dropdown {'value': 'dropdown'}
textfield {'value': 'text1'}
textfield {'value': 'text2'}
elevatedbutton {'text': 'PRINT'}
This is what I want to get:
textfield {'value': 'text1'}
textfield {'value': 'text2'}