fork download
  1. import flet as cs
  2.  
  3. def main(page: cs.Page):
  4. def toggle_theme(e):
  5. if page.theme_mode == cs.ThemeMode.DARK:
  6. page.theme_mode = cs.ThemeMode.LIGHT
  7. else:
  8. page.theme_mode = cs.ThemeMode.DARK
  9. page.update()
  10.  
  11. theme_switch = cs.Switch(label="Dark Mode", on_change=toggle_theme)
  12. page.add(theme_switch)
  13.  
  14. cs.app(target=main)
  15.  
Success #stdin #stdout #stderr 0.02s 6820KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/pWsIQu/prog:14:19: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit