code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
def event_handler(evt): code = evt.get_code() if code == lv.EVENT.CLICKED: print("Clicked event seen") elif code == lv.EVENT.VALUE_CHANGED: print("Value changed seen") # create a simple button btn1 = lv.btn(lv.scr_act()) # attach the callback btn1.add_event_cb(event_handler,lv...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btn/lv_example_btn_1.py
Python
apache-2.0
776
#include "../../lv_examples.h" #if LV_USE_BTN && LV_BUILD_EXAMPLES /** * Style a button from scratch */ void lv_example_btn_2(void) { /*Init the style for the default state*/ static lv_style_t style; lv_style_init(&style); lv_style_set_radius(&style, 3); lv_style_set_bg_opa(&style, LV_OPA_100);...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btn/lv_example_btn_2.c
C
apache-2.0
2,323
# # Style a button from scratch # # Init the style for the default state style = lv.style_t() style.init() style.set_radius(3) style.set_bg_opa(lv.OPA.COVER) style.set_bg_color(lv.palette_main(lv.PALETTE.BLUE)) style.set_bg_grad_color(lv.palette_darken(lv.PALETTE.BLUE, 2)) style.set_bg_grad_dir(lv.GRAD_DIR.VER) sty...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btn/lv_example_btn_2.py
Python
apache-2.0
1,592
#include "../../lv_examples.h" #if LV_BUILD_EXAMPLES && LV_USE_BTN /** * Create a style transition on a button to act like a gum when clicked */ void lv_example_btn_3(void) { /*Properties to transition*/ static lv_style_prop_t props[] = { LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_ST...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btn/lv_example_btn_3.c
C
apache-2.0
1,766
# # Create a style transition on a button to act like a gum when clicked # # Properties to transition props = [lv.STYLE.TRANSFORM_WIDTH, lv.STYLE.TRANSFORM_HEIGHT, lv.STYLE.TEXT_LETTER_SPACE, 0] # Transition descriptor when going back to the default state. # Add some delay to be sure the press transition is visible e...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btn/lv_example_btn_3.py
Python
apache-2.0
1,272
#include "../../lv_examples.h" #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) { uint32_t id = lv_btnmatrix_get_selected_btn(obj); c...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c
C
apache-2.0
1,124
def event_handler(evt): code = evt.get_code() obj = evt.get_target() if code == lv.EVENT.VALUE_CHANGED : id = obj.get_selected_btn() txt = obj.get_btn_text(id) print("%s was pressed"%txt) btnm_map = ["1", "2", "3", "4", "5", "\n", "6", "7", "8", "9", "0", "\n", ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btnmatrix/lv_example_btnmatrix_1.py
Python
apache-2.0
690
#include "../../lv_examples.h" #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES static void event_cb(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_DRAW_PART_BEGIN) { lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e); ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c
C
apache-2.0
2,670
from imagetools import get_png_info, open_png # Register PNG image decoder decoder = lv.img.decoder_create() decoder.info_cb = get_png_info decoder.open_cb = open_png # Create an image from the png file try: with open('../../assets/star.png','rb') as f: png_data = f.read() except: print("Could not fin...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btnmatrix/lv_example_btnmatrix_2.py
Python
apache-2.0
2,882
#include "../../lv_examples.h" #if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES static void event_cb(lv_event_t * e) { lv_obj_t * obj = lv_event_get_target(e); uint32_t id = lv_btnmatrix_get_selected_btn(obj); bool prev = id == 0 ? true : false; bool next = id == 6 ? true : false; if(prev || next) { ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c
C
apache-2.0
2,209
def event_cb(e): obj = e.get_target() id = obj.get_selected_btn() if id == 0: prev = True else: prev = False if id == 6: next = True else: next = False if prev or next: # Find the checked butto for i in range(7): if obj.has_btn_ctrl...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/btnmatrix/lv_example_btnmatrix_3.py
Python
apache-2.0
1,565
#include "../../lv_examples.h" #if LV_USE_CALENDAR && LV_BUILD_EXAMPLES static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_current_target(e); if(code == LV_EVENT_VALUE_CHANGED) { lv_calendar_date_t date; if(lv_calendar_get...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/calendar/lv_example_calendar_1.c
C
apache-2.0
1,599
def event_handler(evt): code = evt.get_code() if code == lv.EVENT.VALUE_CHANGED: source = evt.get_current_target() date = lv.calendar_date_t() if source.get_pressed_date(date) == lv.RES.OK: calendar.set_today_date(date.year, date.month, date.day) print("...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/calendar/lv_example_calendar_1.py
Python
apache-2.0
973
#include "../../lv_examples.h" #if LV_USE_CANVAS && LV_BUILD_EXAMPLES #define CANVAS_WIDTH 200 #define CANVAS_HEIGHT 150 void lv_example_canvas_1(void) { lv_draw_rect_dsc_t rect_dsc; lv_draw_rect_dsc_init(&rect_dsc); rect_dsc.radius = 10; rect_dsc.bg_opa = LV_OPA_COVER; rect_dsc.bg_grad_dir = L...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/canvas/lv_example_canvas_1.c
C
apache-2.0
1,934
_CANVAS_WIDTH = 200 _CANVAS_HEIGHT = 150 LV_IMG_ZOOM_NONE = 256 rect_dsc = lv.draw_rect_dsc_t() rect_dsc.init() rect_dsc.radius = 10 rect_dsc.bg_opa = lv.OPA.COVER rect_dsc.bg_grad_dir = lv.GRAD_DIR.HOR rect_dsc.bg_color = lv.palette_main(lv.PALETTE.RED) rect_dsc.bg_grad_color = lv.palette_main(lv.PALETTE.BLUE) rect...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/canvas/lv_example_canvas_1.py
Python
apache-2.0
1,419
#include "../../lv_examples.h" #if LV_USE_CANVAS && LV_BUILD_EXAMPLES #define CANVAS_WIDTH 50 #define CANVAS_HEIGHT 50 /** * Create a transparent canvas with Chroma keying and indexed color format (palette). */ void lv_example_canvas_2(void) { /*Create a button to better see the transparency*/ lv_btn_crea...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/canvas/lv_example_canvas_2.c
C
apache-2.0
1,297
CANVAS_WIDTH = 50 CANVAS_HEIGHT = 50 LV_COLOR_CHROMA_KEY = lv.color_hex(0x00ff00) def LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h): return int(((w / 8) + 1) * h) def LV_IMG_BUF_SIZE_INDEXED_1BIT(w, h): return LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2 def LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h): return LV_IMG_BUF_SI...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/canvas/lv_example_canvas_2.py
Python
apache-2.0
1,228
#include "../../lv_examples.h" #if LV_USE_CHART && LV_BUILD_EXAMPLES void lv_example_chart_1(void) { /*Create a chart*/ lv_obj_t * chart; chart = lv_chart_create(lv_scr_act()); lv_obj_set_size(chart, 200, 150); lv_obj_center(chart); lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines a...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_1.c
C
apache-2.0
1,491
# Create a chart chart = lv.chart(lv.scr_act()) chart.set_size(200, 150) chart.center() chart.set_type(lv.chart.TYPE.LINE) # Show lines and points too # Add two data series ser1 = chart.add_series(lv.palette_main(lv.PALETTE.RED), lv.chart.AXIS.PRIMARY_Y); ser2 = chart.add_series(lv.palette_main(lv.PALETTE.GREEN), lv...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_1.py
Python
apache-2.0
824
#include "../../lv_examples.h" #if LV_USE_CHART && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES static lv_obj_t * chart1; static lv_chart_series_t * ser1; static lv_chart_series_t * ser2; static void draw_event_cb(lv_event_t * e) { lv_obj_t * obj = lv_event_get_target(e); /*Add the faded area before the lines are dr...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_2.c
C
apache-2.0
4,414
def draw_event_cb(e): obj = e.get_target() # Add the faded area before the lines are drawn dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param()) if dsc.part != lv.PART.ITEMS: return if not dsc.p1 or not dsc.p2: return # Add a line mask that keeps the area below the line lin...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_2.py
Python
apache-2.0
2,340
#include "../../lv_examples.h" #if LV_USE_CHART && LV_BUILD_EXAMPLES static void draw_event_cb(lv_event_t * e) { lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e); if(!lv_obj_draw_part_check_type(dsc, &lv_chart_class, LV_CHART_DRAW_PART_TICK_LABEL)) return; if(dsc->id == LV_CHART_AXIS_PRIMARY_X...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_3.c
C
apache-2.0
2,795
def draw_event_cb(e): dsc = lv.obj_draw_part_dsc_t.__cast__(e.get_param()) if dsc.part == lv.PART.TICKS and dsc.id == lv.chart.AXIS.PRIMARY_X: month = ["Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"] # dsc.text is defined char text[16], I must therefore...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_3.py
Python
apache-2.0
1,850
#include "../../lv_examples.h" #if LV_USE_CHART && LV_BUILD_EXAMPLES static void event_cb(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * chart = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) { lv_obj_invalidate(chart); } if(code == LV_EVENT_REFR_EXT...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_4.c
C
apache-2.0
2,712
def event_cb(e): code = e.get_code() chart = e.get_target() if code == lv.EVENT.VALUE_CHANGED: chart.invalidate() if code == lv.EVENT.REFR_EXT_DRAW_SIZE: e.set_ext_draw_size(20) elif code == lv.EVENT.DRAW_POST_END: id = lv.chart.get_pressed_point(chart) if id == lv...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_4.py
Python
apache-2.0
2,117
#include "../../lv_examples.h" #if LV_USE_CHART && LV_USE_SLIDER && LV_BUILD_EXAMPLES static lv_obj_t * chart; /* Source: https://github.com/ankur219/ECG-Arrhythmia-classification/blob/642230149583adfae1e4bd26c6f0e1fd8af2be0e/sample.csv*/ static const lv_coord_t ecg_sample[] = { -2, 2, 0, -15, -39, -63, -71, -68, ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_5.c
C
apache-2.0
6,809
# Source: https://github.com/ankur219/ECG-Arrhythmia-classification/blob/642230149583adfae1e4bd26c6f0e1fd8af2be0e/sample.csv ecg_sample = [ -2, 2, 0, -15, -39, -63, -71, -68, -67, -69, -84, -95, -104, -107, -108, -107, -107, -107, -107, -114, -118, -117, -112, -100, -89, -83, -71, -64, -58, -58, -62, -62, -58, ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_5.py
Python
apache-2.0
6,132
#include "../../lv_examples.h" #if LV_USE_CHART && LV_BUILD_EXAMPLES static lv_obj_t * chart; static lv_chart_series_t * ser; static lv_chart_cursor_t * cursor; static void event_cb(lv_event_t * e) { static int32_t last_id = -1; lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_ta...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_6.c
C
apache-2.0
2,879
class ExampleChart_6(): def __init__(self): self.last_id = -1 # # Show cursor on the clicked point # chart = lv.chart(lv.scr_act()) chart.set_size(200, 150) chart.align(lv.ALIGN.CENTER, 0, -10) chart.set_axis_tick(lv.chart.AXIS.PRIMARY_Y...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_6.py
Python
apache-2.0
3,297
#include "../../lv_examples.h" #if LV_USE_CHART && LV_BUILD_EXAMPLES static void draw_event_cb(lv_event_t * e) { lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e); if(dsc->part == LV_PART_ITEMS) { lv_obj_t * obj = lv_event_get_target(e); lv_chart_series_t * ser = lv_chart_get_series_...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_7.c
C
apache-2.0
2,596
#!/opt/bin/lv_micropython -i import utime as time import lvgl as lv import display_driver def draw_event_cb(e): dsc = e.get_draw_part_dsc() if dsc.part == lv.PART.ITEMS: obj = e.get_target() ser = obj.get_series_next(None) cnt = obj.get_point_count() # print("cnt: ",cnt) ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_7.py
Python
apache-2.0
2,462
#include "../../lv_examples.h" #if LV_USE_CHART && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES /* A struct is used to keep track of the series list because later we need to draw to the series in the reverse order to which they were initialised. */ typedef struct { lv_obj_t *obj; lv_chart_series_t *series_list[3]; } ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_8.c
C
apache-2.0
5,264
import display_driver import lvgl as lv # A class is used to keep track of the series list because later we # need to draw to the series in the reverse order to which they were initialised. class StackedAreaChart: def __init__(self): self.obj = None self.series_list = [None, None, None] stacked_a...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_8.py
Python
apache-2.0
4,703
#include "../../lv_examples.h" #if LV_USE_CHART && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES static void add_data(lv_timer_t * t) { lv_obj_t * chart = t->user_data; lv_chart_series_t * ser = lv_chart_get_series_next(chart, NULL); lv_chart_set_next_value(chart, ser, lv_rand(10, 90)); uint16_t p = lv_chart...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_9.c
C
apache-2.0
1,268
import display_driver import lvgl as lv def add_data(t): chart.set_next_value(ser, lv.rand(10, 90)) p = chart.get_point_count() s = chart.get_x_start_point(ser) a = chart.get_y_array(ser) a[(s + 1) % p] = lv.CHART_POINT.NONE a[(s + 2) % p] = lv.CHART_POINT.NONE a[(s + 3) % p] = lv.CHART_P...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/chart/lv_example_chart_9.py
Python
apache-2.0
746
#include "../../lv_examples.h" #if LV_USE_CHECKBOX && LV_BUILD_EXAMPLES static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) { const char * txt = lv_checkbox_get_text(obj); const ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/checkbox/lv_example_checkbox_1.c
C
apache-2.0
1,475
def event_handler(e): code = e.get_code() obj = e.get_target() if code == lv.EVENT.VALUE_CHANGED: txt = obj.get_text() if obj.get_state() & lv.STATE.CHECKED: state = "Checked" else: state = "Unchecked"; print(txt + ":" + state) lv.scr_act().set_flex...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/checkbox/lv_example_checkbox_1.py
Python
apache-2.0
992
#include "../../lv_examples.h" #if LV_USE_CHECKBOX && LV_BUILD_EXAMPLES static lv_style_t style_radio; static lv_style_t style_radio_chk; static uint32_t active_index_1 = 0; static uint32_t active_index_2 = 0; static void radio_event_handler(lv_event_t * e) { uint32_t * active_id = lv_event_get_user_data(e); ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/checkbox/lv_example_checkbox_2.c
C
apache-2.0
2,791
#include "../../lv_examples.h" #if LV_USE_COLORWHEEL && LV_BUILD_EXAMPLES void lv_example_colorwheel_1(void) { lv_obj_t * cw; cw = lv_colorwheel_create(lv_scr_act(), true); lv_obj_set_size(cw, 200, 200); lv_obj_center(cw); } #endif
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/colorwheel/lv_example_colorwheel_1.c
C
apache-2.0
251
cw = lv.colorwheel(lv.scr_act(), True) cw.set_size(200, 200) cw.center()
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/colorwheel/lv_example_colorwheel_1.py
Python
apache-2.0
74
#include "../../lv_examples.h" #if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_dropdown_get_selected_str(obj, buf,...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/dropdown/lv_example_dropdown_1.c
C
apache-2.0
1,062
def event_handler(e): code = e.get_code() obj = e.get_target() if code == lv.EVENT.VALUE_CHANGED: option = " "*10 # should be large enough to store the option obj.get_selected_str(option, len(option)) # .strip() removes trailing spaces print("Option: \"%s\"" % option.strip()...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/dropdown/lv_example_dropdown_1.py
Python
apache-2.0
640
#include "../../lv_examples.h" #if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES /** * Create a drop down, up, left and right menus */ void lv_example_dropdown_2(void) { static const char * opts = "Apple\n" "Banana\n" "Orange\n" ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/dropdown/lv_example_dropdown_2.c
C
apache-2.0
1,187
# # Create a drop down, up, left and right menus # opts = "\n".join([ "Apple", "Banana", "Orange", "Melon", "Grape", "Raspberry"]) dd = lv.dropdown(lv.scr_act()) dd.set_options_static(opts) dd.align(lv.ALIGN.TOP_MID, 0, 10) dd = lv.dropdown(lv.scr_act()) dd.set_options_static(opts) dd.set_dir(...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/dropdown/lv_example_dropdown_2.py
Python
apache-2.0
705
#include "../../lv_examples.h" #if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES static void event_cb(lv_event_t * e) { lv_obj_t * dropdown = lv_event_get_target(e); char buf[64]; lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf)); LV_LOG_USER("'%s' is selected", buf); } /** * Create a menu from a drop-...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/dropdown/lv_example_dropdown_3.c
C
apache-2.0
1,568
from imagetools import get_png_info, open_png # Register PNG image decoder decoder = lv.img.decoder_create() decoder.info_cb = get_png_info decoder.open_cb = open_png # Create an image from the png file try: with open('../../assets/img_caret_down.png','rb') as f: png_data = f.read() except: print("Cou...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/dropdown/lv_example_dropdown_3.py
Python
apache-2.0
1,488
#include "../../lv_examples.h" #if LV_USE_IMG && LV_BUILD_EXAMPLES void lv_example_img_1(void) { LV_IMG_DECLARE(img_cogwheel_argb); lv_obj_t * img1 = lv_img_create(lv_scr_act()); lv_img_set_src(img1, &img_cogwheel_argb); lv_obj_align(img1, LV_ALIGN_CENTER, 0, -20); lv_obj_set_size(img1, 200, 200);...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/img/lv_example_img_1.c
C
apache-2.0
497
#!/opt/bin/lv_micropython -i import usys as sys import lvgl as lv import display_driver from imagetools import get_png_info, open_png # Register PNG image decoder decoder = lv.img.decoder_create() decoder.info_cb = get_png_info decoder.open_cb = open_png # Create an image from the png file try: with open('../../a...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/img/lv_example_img_1.py
Python
apache-2.0
795
#include "../../lv_examples.h" #if LV_USE_IMG && LV_USE_SLIDER && LV_BUILD_EXAMPLES static lv_obj_t * create_slider(lv_color_t color); static void slider_event_cb(lv_event_t * e); static lv_obj_t * red_slider, * green_slider, * blue_slider, * intense_slider; static lv_obj_t * img1; /** * Demonstrate runtime image ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/img/lv_example_img_2.c
C
apache-2.0
2,413
#!/opt/bin/lv_micropython -i import usys as sys import lvgl as lv import display_driver from imagetools import get_png_info, open_png # Register PNG image decoder decoder = lv.img.decoder_create() decoder.info_cb = get_png_info decoder.open_cb = open_png # Create an image from the png file try: with open('../../a...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/img/lv_example_img_2.py
Python
apache-2.0
2,202
#include "../../lv_examples.h" #if LV_USE_IMG && LV_BUILD_EXAMPLES static void set_angle(void * img, int32_t v) { lv_img_set_angle(img, v); } static void set_zoom(void * img, int32_t v) { lv_img_set_zoom(img, v); } /** * Show transformations (zoom and rotation) using a pivot point. */ void lv_example_img_...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/img/lv_example_img_3.c
C
apache-2.0
1,037
#!/opt/bin/lv_micropython -i import usys as sys import lvgl as lv import display_driver from imagetools import get_png_info, open_png # Register PNG image decoder decoder = lv.img.decoder_create() decoder.info_cb = get_png_info decoder.open_cb = open_png # Create an image from the png file try: with open('../../a...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/img/lv_example_img_3.py
Python
apache-2.0
1,348
#include "../../lv_examples.h" #if LV_USE_IMG && LV_BUILD_EXAMPLES static void ofs_y_anim(void * img, int32_t v) { lv_img_set_offset_y(img, v); } /** * Image styling and offset */ void lv_example_img_4(void) { LV_IMG_DECLARE(img_skew_strip); static lv_style_t style; lv_style_init(&style); lv_st...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/img/lv_example_img_4.c
C
apache-2.0
1,044
from imagetools import get_png_info, open_png def ofs_y_anim(img, v): img.set_offset_y(v) # print(img,v) # Register PNG image decoder decoder = lv.img.decoder_create() decoder.info_cb = get_png_info decoder.open_cb = open_png # Create an image from the png file try: with open('../../assets/img_sk...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/img/lv_example_img_4.py
Python
apache-2.0
1,107
#include "../../lv_examples.h" #if LV_USE_IMGBTN && LV_BUILD_EXAMPLES void lv_example_imgbtn_1(void) { LV_IMG_DECLARE(imgbtn_left); LV_IMG_DECLARE(imgbtn_right); LV_IMG_DECLARE(imgbtn_mid); /*Create a transition animation on width transformation and recolor.*/ static lv_style_prop_t tr_prop[] = {L...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/imgbtn/lv_example_imgbtn_1.c
C
apache-2.0
1,491
from imagetools import get_png_info, open_png # Register PNG image decoder decoder = lv.img.decoder_create() decoder.info_cb = get_png_info decoder.open_cb = open_png # Create an image from the png file try: with open('../../assets/imgbtn_left.png','rb') as f: imgbtn_left_data = f.read() except: print...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/imgbtn/lv_example_imgbtn_1.py
Python
apache-2.0
1,966
#include "../../lv_examples.h" #if LV_USE_KEYBOARD && LV_BUILD_EXAMPLES static void ta_event_cb(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * ta = lv_event_get_target(e); lv_obj_t * kb = lv_event_get_user_data(e); if(code == LV_EVENT_FOCUSED) { lv_keyboard_set_textar...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/keyboard/lv_example_keyboard_1.c
C
apache-2.0
1,230
def ta_event_cb(e,kb): code = e.get_code() ta = e.get_target() if code == lv.EVENT.FOCUSED: kb.set_textarea(ta) kb.clear_flag(lv.obj.FLAG.HIDDEN) if code == lv.EVENT.DEFOCUSED: kb.set_textarea(None) kb.add_flag(lv.obj.FLAG.HIDDEN) # Create a keyboard to use it w...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/keyboard/lv_example_keyboard_1.py
Python
apache-2.0
786
#include "../../lv_examples.h" #if LV_USE_LABEL && LV_BUILD_EXAMPLES /** * Show line wrap, re-color, line align and text scrolling. */ void lv_example_label_1(void) { lv_obj_t * label1 = lv_label_create(lv_scr_act()); lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); /*Break the long lines*/ lv_lab...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/label/lv_example_label_1.c
C
apache-2.0
1,114
# # Show line wrap, re-color, line align and text scrolling. # label1 = lv.label(lv.scr_act()) label1.set_long_mode(lv.label.LONG.WRAP); # Break the long lines*/ label1.set_recolor(True) # Enable re-coloring by commands in the text label1.set_text("#0000ff Re-color# #ff00ff words# #ff0000 of a#...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/label/lv_example_label_1.py
Python
apache-2.0
821
#include "../../lv_examples.h" #if LV_USE_LABEL && LV_BUILD_EXAMPLES /** * Create a fake text shadow */ void lv_example_label_2(void) { /*Create a style for the shadow*/ static lv_style_t style_shadow; lv_style_init(&style_shadow); lv_style_set_text_opa(&style_shadow, LV_OPA_30); lv_style_set_tex...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/label/lv_example_label_2.c
C
apache-2.0
1,229
# # Create a fake text shadow # # Create a style for the shadow style_shadow = lv.style_t() style_shadow.init() style_shadow.set_text_opa(lv.OPA._30) style_shadow.set_text_color(lv.color_black()) # Create a label for the shadow first (it's in the background) shadow_label = lv.label(lv.scr_act()) shadow_label.add_styl...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/label/lv_example_label_2.py
Python
apache-2.0
864
#include "../../lv_examples.h" #if LV_USE_LABEL && LV_BUILD_EXAMPLES && LV_FONT_DEJAVU_16_PERSIAN_HEBREW && LV_FONT_SIMSUN_16_CJK && LV_USE_BIDI /** * Show mixed LTR, RTL and Chinese label */ void lv_example_label_3(void) { lv_obj_t * ltr_label = lv_label_create(lv_scr_act()); lv_label_set_text(ltr_label, "I...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/label/lv_example_label_3.c
C
apache-2.0
1,427
import fs_driver # # Show mixed LTR, RTL and Chinese label # ltr_label = lv.label(lv.scr_act()) ltr_label.set_text("In modern terminology, a microcontroller is similar to a system on a chip (SoC)."); # ltr_label.set_style_text_font(ltr_label, &lv_font_montserrat_16, 0); fs_drv = lv.fs_drv_t() fs_driver.fs_register(fs...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/label/lv_example_label_3.py
Python
apache-2.0
1,392
#include "../../lv_examples.h" #if LV_USE_LABEL && LV_BUILD_EXAMPLES && LV_DRAW_COMPLEX #define MASK_WIDTH 100 #define MASK_HEIGHT 45 static void add_mask_event_cb(lv_event_t * e) { static lv_draw_mask_map_param_t m; static int16_t mask_id; lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/label/lv_example_label_4.c
C
apache-2.0
2,199
#include "../../lv_examples.h" #if LV_USE_LED && LV_BUILD_EXAMPLES /** * Create LED's with different brightness and color */ void lv_example_led_1(void) { /*Create a LED and switch it OFF*/ lv_obj_t * led1 = lv_led_create(lv_scr_act()); lv_obj_align(led1, LV_ALIGN_CENTER, -80, 0); lv_led_off(led1); ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/led/lv_example_led_1.c
C
apache-2.0
749
# # Create LED's with different brightness and color # # Create a LED and switch it OFF led1 = lv.led(lv.scr_act()) led1.align(lv.ALIGN.CENTER, -80, 0) led1.off() # Copy the previous LED and set a brightness led2 = lv.led(lv.scr_act()) led2.align(lv.ALIGN.CENTER, 0, 0) led2.set_brightness(150) led2.set_color(lv.pal...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/led/lv_example_led_1.py
Python
apache-2.0
464
#include "../../lv_examples.h" #if LV_USE_LINE && LV_BUILD_EXAMPLES void lv_example_line_1(void) { /*Create an array for the points of the line*/ static lv_point_t line_points[] = { {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240, 10} }; /*Create style*/ static lv_style_t style_line; lv_style_init(&s...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/line/lv_example_line_1.c
C
apache-2.0
765
# Create an array for the points of the line line_points = [ {"x":5, "y":5}, {"x":70, "y":70}, {"x":120, "y":10}, {"x":180, "y":60}, {"x":240, "y":10}] # Create style style_line = lv.style_t() style_line.init() style_line.set_line_width(8) style_line....
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/line/lv_example_line_1.py
Python
apache-2.0
575
#include "../../lv_examples.h" #if LV_USE_LIST && LV_BUILD_EXAMPLES static lv_obj_t * list1; static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_CLICKED) { LV_LOG_USER("Clicked: %s", lv_list_get_btn_te...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/list/lv_example_list_1.c
C
apache-2.0
2,118
def event_handler(e): code = e.get_code() obj = e.get_target() if code == lv.EVENT.CLICKED: print("Clicked: list1." + list1.get_btn_text(obj)) # Create a list list1 = lv.list(lv.scr_act()) list1.set_size(180, 220) list1.center() # Add buttons to the list list1.add_text("File") btn_new = list1....
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/list/lv_example_list_1.py
Python
apache-2.0
1,570
#include <stdlib.h> #include "../../lv_examples.h" #if LV_USE_LIST && LV_BUILD_EXAMPLES static lv_obj_t* list1; static lv_obj_t* list2; static lv_obj_t* currentButton = NULL; static void event_handler(lv_event_t* e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t* obj = lv_event_get_target(e); ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/list/lv_example_list_2.c
C
apache-2.0
5,507
import urandom currentButton = None list1 = None def event_handler(evt): global currentButton code = evt.get_code() obj = evt.get_target() if code == lv.EVENT.CLICKED: if currentButton == obj: currentButton = None else: currentButton = obj parent = obj.g...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/list/lv_example_list_2.py
Python
apache-2.0
4,273
#!/opt/bin/lv_micropython -i import lvgl as lv import display_driver def event_handler(e): code = e.get_code() obj = e.get_target() if code == lv.EVENT.CLICKED: print("Clicked: list1." + list1.get_btn_text(obj)) # Create a list list1 = lv.list(lv.scr_act()) list1.set_size(180, 220) list1.center...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/list/test.py
Python
apache-2.0
1,639
/** * @file lv_example_widgets.h * */ #ifndef LV_EXAMPLE_WIDGETS_H #define LV_EXAMPLE_WIDGETS_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ /********************* * DEFINES *********************/ /********************** * TYPEDEFS ********...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/lv_example_widgets.h
C
apache-2.0
2,867
#include "../../lv_examples.h" #if LV_USE_METER && LV_BUILD_EXAMPLES static lv_obj_t * meter; static void set_value(void * indic, int32_t v) { lv_meter_set_indicator_value(meter, indic, v); } /** * A simple meter */ void lv_example_meter_1(void) { meter = lv_meter_create(lv_scr_act()); lv_obj_center(me...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/meter/lv_example_meter_1.c
C
apache-2.0
2,292
#!//opt/bin/lv_micropython -i import utime as time import lvgl as lv import display_driver def set_value(indic, v): meter.set_indicator_value(indic, v) # # A simple meter # meter = lv.meter(lv.scr_act()) meter.center() meter.set_size(200, 200) # Add a scale first scale = meter.add_scale() meter.set_scale_ticks(s...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/meter/lv_example_meter_1.py
Python
apache-2.0
1,762
#include "../../lv_examples.h" #if LV_USE_METER && LV_BUILD_EXAMPLES static lv_obj_t * meter; static void set_value(void * indic, int32_t v) { lv_meter_set_indicator_end_value(meter, indic, v); } /** * A meter with multiple arcs */ void lv_example_meter_2(void) { meter = lv_meter_create(lv_scr_act()); ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/meter/lv_example_meter_2.c
C
apache-2.0
1,867
#!//opt/bin/lv_micropython -i import utime as time import lvgl as lv import display_driver def set_value(indic,v): meter.set_indicator_end_value(indic, v) # # A meter with multiple arcs # meter = lv.meter(lv.scr_act()) meter.center() meter.set_size(200, 200) # Remove the circle from the middle meter.remove_styl...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/meter/lv_example_meter_2.py
Python
apache-2.0
1,742
#include "../../lv_examples.h" #if LV_USE_METER && LV_BUILD_EXAMPLES static lv_obj_t * meter; static void set_value(void * indic, int32_t v) { lv_meter_set_indicator_end_value(meter, indic, v); } /** * A clock from a meter */ void lv_example_meter_3(void) { meter = lv_meter_create(lv_scr_act()); lv_obj...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/meter/lv_example_meter_3.c
C
apache-2.0
2,029
#!//opt/bin/lv_micropython -i import utime as time import lvgl as lv import display_driver from imagetools import get_png_info, open_png # Register PNG image decoder decoder = lv.img.decoder_create() decoder.info_cb = get_png_info decoder.open_cb = open_png # Create an image from the png file try: with open('../....
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/meter/lv_example_meter_3.py
Python
apache-2.0
2,497
#include "../../lv_examples.h" #if LV_USE_METER && LV_BUILD_EXAMPLES /** * Create a pie chart */ void lv_example_meter_4(void) { lv_obj_t * meter = lv_meter_create(lv_scr_act()); /*Remove the background and the circle from the middle*/ lv_obj_remove_style(meter, NULL, LV_PART_MAIN); lv_obj_remove_st...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/meter/lv_example_meter_4.c
C
apache-2.0
1,488
# # 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...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/meter/lv_example_meter_4.py
Python
apache-2.0
997
#include "../../lv_examples.h" #if LV_USE_MSGBOX && LV_BUILD_EXAMPLES static void event_cb(lv_event_t * e) { lv_obj_t * obj = lv_event_get_current_target(e); LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj)); } void lv_example_msgbox_1(void) { static const char * btns[] ={"Apply", "Clos...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.c
C
apache-2.0
549
def event_cb(e): mbox = e.get_current_target() print("Button %s clicked" % mbox.get_active_btn_text()) btns = ["Apply", "Close", ""] mbox1 = lv.msgbox(lv.scr_act(), "Hello", "This is a message box with two buttons.", btns, True) mbox1.add_event_cb(event_cb, lv.EVENT.VALUE_CHANGED, None) mbox1.center()
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/msgbox/lv_example_msgbox_1.py
Python
apache-2.0
314
#include "../../lv_examples.h" #if LV_BUILD_EXAMPLES void lv_example_obj_1(void) { lv_obj_t * obj1; obj1 = lv_obj_create(lv_scr_act()); lv_obj_set_size(obj1, 100, 50); lv_obj_align(obj1, LV_ALIGN_CENTER, -60, -30); static lv_style_t style_shadow; lv_style_init(&style_shadow); lv_style_set_...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/obj/lv_example_obj_1.c
C
apache-2.0
649
obj1 = lv.obj(lv.scr_act()) obj1.set_size(100, 50) obj1.align(lv.ALIGN.CENTER, -60, -30) style_shadow = lv.style_t() style_shadow.init() style_shadow.set_shadow_width(10) style_shadow.set_shadow_spread(5) style_shadow.set_shadow_color(lv.palette_main(lv.PALETTE.BLUE)) obj2 = lv.obj(lv.scr_act()) obj2.add_style(style_...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/obj/lv_example_obj_1.py
Python
apache-2.0
368
#include "../../lv_examples.h" #if LV_BUILD_EXAMPLES static void drag_event_handler(lv_event_t * e) { lv_obj_t * obj = lv_event_get_target(e); lv_indev_t * indev = lv_indev_get_act(); lv_point_t vect; lv_indev_get_vect(indev, &vect); lv_coord_t x = lv_obj_get_x(obj) + vect.x; lv_coord_t y = l...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/obj/lv_example_obj_2.c
C
apache-2.0
741
def drag_event_handler(e): obj = e.get_target() indev = lv.indev_get_act() vect = lv.point_t() indev.get_vect(vect) x = obj.get_x() + vect.x y = obj.get_y() + vect.y obj.set_pos(x, y) # # Make an object dragable. # obj = lv.obj(lv.scr_act()) obj.set_size(150, 100) obj.add_event_cb(drag...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/obj/lv_example_obj_2.py
Python
apache-2.0
426
#include "../../lv_examples.h" #if LV_USE_ROLLER && LV_BUILD_EXAMPLES static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_roller_get_selected_str(obj, buf, siz...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/roller/lv_example_roller_1.c
C
apache-2.0
1,200
def event_handler(e): code = e.get_code() obj = e.get_target() if code == lv.EVENT.VALUE_CHANGED: option = " "*10 obj.get_selected_str(option, len(option)) print("Selected month: " + option.strip()) # # An infinite roller with the name of the months # roller1 = lv.roller(lv.scr_act...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/roller/lv_example_roller_1.py
Python
apache-2.0
660
#include "../../lv_examples.h" #if LV_USE_ROLLER && LV_FONT_MONTSERRAT_22 && LV_BUILD_EXAMPLES static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_roller_get_s...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/roller/lv_example_roller_2.c
C
apache-2.0
2,385
import fs_driver def event_handler(e): code = e.get_code() obj = e.get_target() if code == lv.EVENT.VALUE_CHANGED: option = " "*10 obj.get_selected_str(option, len(option)) print("Selected value: %s\n" + option.strip()) # # Roller with various alignments and larger text in the sel...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/roller/lv_example_roller_2.py
Python
apache-2.0
2,057
#include "../../lv_examples.h" #if LV_USE_ROLLER && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES static void mask_event_cb(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); static int16_t mask_top_id = -1; static int16_t mask_bottom_id = -1; if (code ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/roller/lv_example_roller_3.c
C
apache-2.0
3,506
import fs_driver import sys class Lv_Roller_3(): def __init__(self): self.mask_top_id = -1 self.mask_bottom_id = -1 # # Add an fade mask to roller. # style = lv.style_t() style.init() style.set_bg_color(lv.color_black()) style.set_...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/roller/lv_example_roller_3.py
Python
apache-2.0
3,562
#include "../../lv_examples.h" #if LV_USE_SLIDER && LV_BUILD_EXAMPLES static void slider_event_cb(lv_event_t * e); static lv_obj_t * slider_label; /** * A default slider with a label displaying the current value */ void lv_example_slider_1(void) { /*Create a slider in the center of the display*/ lv_obj_t * ...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/slider/lv_example_slider_1.c
C
apache-2.0
996
# # A default slider with a label displaying the current value # def slider_event_cb(e): slider = e.get_target() slider_label.set_text("{:d}%".format(slider.get_value())) slider_label.align_to(slider, lv.ALIGN.OUT_BOTTOM_MID, 0, 10) # Create a slider in the center of the display slider = lv.slider(lv.scr...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/slider/lv_example_slider_1.py
Python
apache-2.0
576
#include "../../lv_examples.h" #if LV_USE_SLIDER && LV_BUILD_EXAMPLES /** * Show how to style a slider. */ void lv_example_slider_2(void) { /*Create a transition*/ static const lv_style_prop_t props[] = {LV_STYLE_BG_COLOR, 0}; static lv_style_transition_dsc_t transition_dsc; lv_style_transition_dsc...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/slider/lv_example_slider_2.c
C
apache-2.0
2,296
# # Show how to style a slider. # # Create a transition props = [lv.STYLE.BG_COLOR, 0] transition_dsc = lv.style_transition_dsc_t() transition_dsc.init(props, lv.anim_t.path_linear, 300, 0, None) style_main = lv.style_t() style_indicator = lv.style_t() style_knob = lv.style_t() style_pressed_color = lv.style_t() styl...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/slider/lv_example_slider_2.py
Python
apache-2.0
1,670
#include "../../lv_examples.h" #if LV_USE_SLIDER && LV_BUILD_EXAMPLES static void slider_event_cb(lv_event_t * e); /** * Show the current value when the slider is pressed by extending the drawer * */ void lv_example_slider_3(void) { /*Create a slider in the center of the display*/ lv_obj_t * slider; sl...
YifuLiu/AliOS-Things
components/py_engine/engine/lib/lv_bindings/lvgl/examples/widgets/slider/lv_example_slider_3.c
C
apache-2.0
1,934