[Python] How can I autoscroll or go to the last position of a multiline TextField in Flet?

Discussão em 'Python' iniciado por Stack, Junho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to get a TextField in Flet to which text is added to update and display the last entry. So far, I've only managed to do this if I make the entry appear on the first line, but if I make it appear on the last line, the TextField expands but doesn't scroll to the last entry. Any ideas or tips I can try?

    Thanks.

    *#TextField
    txt_salida=ft.TextField(multiline=True, min_lines=10, max_lines=10, expand=True, read_only=True, filled=True)
    #New entry goes at the top position
    txt_salida.value = f'{valor}\n'+ txt_salida.value
    page.update()
    #New entry goes at the bottom
    txt_salida.value = txt_salida.value + f'{valor}\n'
    page.update()*

    Continue reading...

Compartilhe esta Página