MCPcopy
hub / github.com/flet-dev/flet / init

Method init

sdk/python/examples/tutorials/todo/todo.py:82–119  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

80class TodoApp(ft.Column):
81 # application's root control is a Column containing all other controls
82 def init(self):
83 self.new_task = ft.TextField(hint_text="Whats needs to be done?", expand=True)
84 self.tasks = ft.Column()
85
86 self.filter = ft.TabBar(
87 scrollable=False,
88 tabs=[
89 ft.Tab(label="all"),
90 ft.Tab(label="active"),
91 ft.Tab(label="completed"),
92 ],
93 )
94
95 self.filter_tabs = ft.Tabs(
96 length=3,
97 selected_index=0,
98 on_change=lambda e: self.update(),
99 content=self.filter,
100 )
101
102 self.width = 600
103 self.controls = [
104 ft.Row(
105 controls=[
106 self.new_task,
107 ft.FloatingActionButton(
108 icon=ft.Icons.ADD, on_click=self.add_clicked
109 ),
110 ],
111 ),
112 ft.Column(
113 spacing=25,
114 controls=[
115 self.filter_tabs,
116 self.tasks,
117 ],
118 ),
119 ]
120
121 def add_clicked(self, e):
122 task = Task(

Callers

nothing calls this directly

Calls 1

updateMethod · 0.95

Tested by

no test coverage detected