Skip to content
Discussion options

You must be logged in to vote

@AaronCatolico , maybe the following will help.

import flet as ft


class Control1(ft.UserControl):
    def __init__(self):
        super().__init__()
        self.con1 = ft.Ref[ft.Container]

    def build(self):
        return ft.Container(
            ref=self.con1,
            width=200,
            height=200,
            bgcolor='red',
            border_radius=6
        )


class Control2(Control1):
    def __init__(self):
        super().__init__()

    def change_color(self, e):
        # The function that will change 'self.con1' container to blue, located in the
        # 'Control1' class.
        self.con1.current.bgcolor = ft.colors.BLUE
        self.con1.current.update()
    …

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@AaronCatolico
Comment options

@thetrotfreak
Comment options

@AaronCatolico
Comment options

@thetrotfreak
Comment options

@AaronCatolico
Comment options

Answer selected by AaronCatolico
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