1
0

main.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env python3
  2. from datetime import datetime
  3. from fullcalendar import FullCalendar as fullcalendar
  4. from nicegui import events, ui
  5. options = {
  6. 'initialView': 'dayGridMonth',
  7. 'headerToolbar': {'left': 'title', 'right': ''},
  8. 'footerToolbar': {'right': 'prev,next today'},
  9. 'slotMinTime': '05:00:00',
  10. 'slotMaxTime': '22:00:00',
  11. 'allDaySlot': False,
  12. 'timeZone': 'local',
  13. 'height': 'auto',
  14. 'width': 'auto',
  15. 'events': [
  16. {
  17. 'title': 'Math',
  18. 'start': datetime.now().strftime(r'%Y-%m-%d') + ' 08:00:00',
  19. 'end': datetime.now().strftime(r'%Y-%m-%d') + ' 10:00:00',
  20. 'color': 'red',
  21. },
  22. {
  23. 'title': 'Physics',
  24. 'start': datetime.now().strftime(r'%Y-%m-%d') + ' 10:00:00',
  25. 'end': datetime.now().strftime(r'%Y-%m-%d') + ' 12:00:00',
  26. 'color': 'green',
  27. },
  28. {
  29. 'title': 'Chemistry',
  30. 'start': datetime.now().strftime(r'%Y-%m-%d') + ' 13:00:00',
  31. 'end': datetime.now().strftime(r'%Y-%m-%d') + ' 15:00:00',
  32. 'color': 'blue',
  33. },
  34. {
  35. 'title': 'Biology',
  36. 'start': datetime.now().strftime(r'%Y-%m-%d') + ' 15:00:00',
  37. 'end': datetime.now().strftime(r'%Y-%m-%d') + ' 17:00:00',
  38. 'color': 'orange',
  39. },
  40. ],
  41. }
  42. def handle_click(event: events.GenericEventArguments):
  43. if 'info' in event.args:
  44. ui.notify(event.args['info']['event'])
  45. fullcalendar(options, on_click=handle_click)
  46. ui.run()