Skip to content
Discussion options

You must be logged in to vote

So, I tried your code with the flet v0.4.0.dev1117, and the only change you have to make having this version is to change e.bgcolor to tb.bgcolor. Below is the full code with that one line modification. It works as expected.

import flet as ft

def main(page: ft.Page):
    def textbox_changed(e):
        tb.bgcolor = ft.colors.RED   ### <-------------------- change e.bgcolor to tb.bgcolor
        c.bgcolor = ft.colors.RED
        page.update()

    c = ft.Container(
        content=ft.Text('test'),
        bgcolor=ft.colors.YELLOW,
        padding=5,
    )

    tb = ft.TextField(
        bgcolor=ft.colors.AMBER,
        label="Textbox with 'change' event:",
        on_submit=textbox_changed

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@valer85
Comment options

@ndonkoHenri
Comment options

@valer85
Comment options

@ndonkoHenri
Comment options

@valer85
Comment options

Answer selected by valer85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants