Replies: 1 comment 1 reply
-
You can just have an async method creating an instance of import flet as ft
class App:
def __init__(self, page: ft.Page) -> None:
self.page = page
async def init(self):
self.page.theme_mode = 'light'
self.page.fonts = FONTS
self.page.title = 'Nascin Exchange'
self.page.theme = ft.Theme(font_family='Roboto')
# ...
# await methods come here
async def main(page: ft.Page):
await App(page).init()
if __name__ == '__main__':
ft.app(
target=main,
port=APP['port'],
view=ft.WEB_BROWSER,
route_url_strategy=APP['route_url_strategy'],
assets_dir='exchange/assets'
) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the example of async a main function is used, but in the case of a class, what would be the solution?
Beta Was this translation helpful? Give feedback.
All reactions