lv_table1.py 921 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!pika
  2. import pika_lvgl as lv
  3. import PikaStdLib
  4. mem = PikaStdLib.MemChecker()
  5. table = lv.table(lv.scr_act())
  6. # Fill the first column
  7. table.set_cell_value(0, 0, "Name")
  8. table.set_cell_value(1, 0, "Apple")
  9. table.set_cell_value(2, 0, "Banana")
  10. table.set_cell_value(3, 0, "Lemon")
  11. table.set_cell_value(4, 0, "Grape")
  12. table.set_cell_value(5, 0, "Melon")
  13. table.set_cell_value(6, 0, "Peach")
  14. table.set_cell_value(7, 0, "Nuts")
  15. # Fill the second column
  16. table.set_cell_value(0, 1, "Price")
  17. table.set_cell_value(1, 1, "$7")
  18. table.set_cell_value(2, 1, "$4")
  19. table.set_cell_value(3, 1, "$6")
  20. table.set_cell_value(4, 1, "$2")
  21. table.set_cell_value(5, 1, "$5")
  22. table.set_cell_value(6, 1, "$1")
  23. table.set_cell_value(7, 1, "$9")
  24. # Set a smaller height to the table. It'll make it scrollable
  25. table.set_height(200)
  26. table.center()
  27. print('mem used max: %0.2f kB' % (mem.getMax()))
  28. print('mem used now: %0.2f kB' % (mem.getNow()))
  29. #!pika