Skip to content

Why does it give an error? #2616

Answered by burhansvural
burhansvural asked this question in Q&A
Discussion options

You must be logged in to vote

problem solved

import flet as ft

def main(page: ft.Page):  

    favorite:bool=False

    def deneme_chip_click(e):        
        nonlocal favorite
        favorite = not favorite
        if favorite:
            e.control.leading=ft.Icon(ft.icons.FAVORITE_OUTLINE_SHARP)
        else:
            e.control.leading=ft.Icon(ft.icons.FAVORITE)
        page.update()
        
    deneme_chip=ft.Chip(
        label=ft.Text("Deneme"),
        leading= ft.Icon(name=ft.icons.FAVORITE),
        autofocus=True,
        on_click=deneme_chip_click,
    )

    page.add(ft.Row(controls=[deneme_chip]))    

ft.app(target=main)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by burhansvural
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
1 participant