main.py 623 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python3
  2. from nice_gui import ui
  3. from datetime import datetime
  4. from matplotlib import pyplot as plt
  5. ui.label('Hello world!')
  6. ui.button('Click me!', on_click=lambda: ui.label('Yes!'))
  7. with ui.card():
  8. with ui.row():
  9. ui.label('A')
  10. ui.label('B')
  11. with ui.column():
  12. ui.label('C1')
  13. ui.label('C2')
  14. ui.label('C3')
  15. with ui.row():
  16. ui.label('Time:')
  17. time = ui.label()
  18. ui.timer(0.1, lambda: time.set_text(datetime.now().strftime("%X")))
  19. with ui.plot():
  20. plt.title('Some plot')
  21. plt.plot(range(10), [x**2 for x in range(10)])
  22. ui.run()