1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/examples/widgets/meter/lv_example_meter_4.py
Amir Gonnen 4114dc30e8
fix(examples) fix MicroPython examples and run the examples with CI (#2339)
* Fixes to micropython examples

Added missing images and fonts under 'assets'. Since .bin is in gitignore, renamed fonts to .fnt

* Update build_micropython workflow

Build the unix port dev variant and run tests.

See: https://github.com/lvgl/lv_binding_micropython/issues/151
2021-07-01 14:37:57 +02:00

33 lines
997 B
Python

#
# Create a pie chart
#
meter = lv.meter(lv.scr_act())
# Remove the background and the circle from the middle
meter.remove_style(None, lv.PART.MAIN)
meter.remove_style(None, lv.PART.INDICATOR)
meter.set_size(200, 200)
meter.center()
# Add a scale first with no ticks.
scale = meter.add_scale()
meter.set_scale_ticks(scale, 0, 0, 0, lv.color_black())
meter.set_scale_range(scale, 0, 100, 360, 0)
# Add a three arc indicator*
indic_w = 100
indic1 = meter.add_arc(scale, indic_w,lv.palette_main(lv.PALETTE.ORANGE), 0)
meter.set_indicator_start_value(indic1, 0)
meter.set_indicator_end_value(indic1, 40)
indic2 = meter.add_arc(scale, indic_w, lv.palette_main(lv.PALETTE.YELLOW), 0)
meter.set_indicator_start_value(indic2, 40) # Start from the previous
meter.set_indicator_end_value(indic2, 80)
indic3 = meter.add_arc(scale, indic_w, lv.palette_main(lv.PALETTE.DEEP_ORANGE), 0)
meter.set_indicator_start_value(indic3, 80) # Start from the previous
meter.set_indicator_end_value(indic3, 100)