chore: many trivial spelling and layout fixes (#3008)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
@@ -32,7 +32,7 @@ static void page_obj_init(lv_obj_t * par);
|
||||
static void anim_x_cb(void * var, int32_t v);
|
||||
|
||||
/**
|
||||
* create a animation
|
||||
* create an animation
|
||||
*/
|
||||
void lv_example_anim_3(void)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ void setup()
|
||||
tft.setRotation( 3 ); /* Landscape orientation, flipped */
|
||||
|
||||
/*Set the touchscreen calibration data,
|
||||
the actual data for your display can be aquired using
|
||||
the actual data for your display can be acquired using
|
||||
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
|
||||
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
|
||||
tft.setTouch( calData );
|
||||
|
||||
@@ -4,7 +4,7 @@ def event_cb(e,label):
|
||||
label.set_text("The last button event:\nLV_EVENT_PRESSED")
|
||||
elif code == lv.EVENT.CLICKED:
|
||||
label.set_text("The last button event:\nLV_EVENT_CLICKED")
|
||||
elif code == lv.EVENT.LONG_PRESSED:
|
||||
elif code == lv.EVENT.LONG_PRESSED:
|
||||
label.set_text("The last button event:\nLV_EVENT_LONG_PRESSED")
|
||||
elif code == lv.EVENT.LONG_PRESSED_REPEAT:
|
||||
label.set_text("The last button event:\nLV_EVENT_LONG_PRESSED_REPEAT")
|
||||
|
||||
@@ -65,7 +65,7 @@ void lv_example_get_started_2(void)
|
||||
lv_label_set_text(label, "Button");
|
||||
lv_obj_center(label);
|
||||
|
||||
/*Create an other button and use the red style too*/
|
||||
/*Create another button and use the red style too*/
|
||||
lv_obj_t * btn2 = lv_btn_create(lv_scr_act());
|
||||
lv_obj_remove_style_all(btn2); /*Remove the styles coming from the theme*/
|
||||
lv_obj_set_pos(btn2, 10, 80);
|
||||
|
||||
@@ -46,7 +46,7 @@ label = lv.label(btn) # Add a label to the button
|
||||
label.set_text("Button") # Set the labels text
|
||||
label.center()
|
||||
|
||||
# Create an other button and use the red style too
|
||||
# Create another button and use the red style too
|
||||
btn2 = lv.btn(lv.scr_act())
|
||||
btn2.remove_style_all() # Remove the styles coming from the theme
|
||||
btn2.set_pos(10, 80) # Set its position
|
||||
|
||||
@@ -11,7 +11,7 @@ cont.set_grid_dsc_array(col_dsc, row_dsc)
|
||||
cont.set_size(300, 220)
|
||||
cont.center()
|
||||
|
||||
# Cell to 0;0 and align to to the start (left/top) horizontally and vertically too
|
||||
# Cell to 0;0 and align to the start (left/top) horizontally and vertically too
|
||||
obj = lv.obj(cont)
|
||||
obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
|
||||
obj.set_grid_cell(lv.GRID_ALIGN.START, 0, 1,
|
||||
@@ -19,7 +19,7 @@ obj.set_grid_cell(lv.GRID_ALIGN.START, 0, 1,
|
||||
label = lv.label(obj)
|
||||
label.set_text("c0, r0")
|
||||
|
||||
# Cell to 1;0 and align to to the start (left) horizontally and center vertically too
|
||||
# Cell to 1;0 and align to the start (left) horizontally and center vertically too
|
||||
obj = lv.obj(cont)
|
||||
obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
|
||||
obj.set_grid_cell(lv.GRID_ALIGN.START, 1, 1,
|
||||
@@ -27,7 +27,7 @@ obj.set_grid_cell(lv.GRID_ALIGN.START, 1, 1,
|
||||
label = lv.label(obj)
|
||||
label.set_text("c1, r0")
|
||||
|
||||
# Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too
|
||||
# Cell to 2;0 and align to the start (left) horizontally and end (bottom) vertically too
|
||||
obj = lv.obj(cont)
|
||||
obj.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
|
||||
obj.set_grid_cell(lv.GRID_ALIGN.START, 2, 1,
|
||||
@@ -50,4 +50,3 @@ obj.set_grid_cell(lv.GRID_ALIGN.STRETCH, 0, 1,
|
||||
lv.GRID_ALIGN.STRETCH, 1, 2)
|
||||
label = lv.label(obj)
|
||||
label.set_text("c0\nr1-2")
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Open a front with FreeTpye
|
||||
Open a front with FreeType
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: libs/freetype/lv_example_freetype_1
|
||||
|
||||
@@ -8,7 +8,7 @@ decoder = lv.img.decoder_create()
|
||||
decoder.info_cb = get_png_info
|
||||
decoder.open_cb = open_png
|
||||
|
||||
img_wink_png = lv.img_dsc_t(
|
||||
img_wink_png = lv.img_dsc_t(
|
||||
{
|
||||
"header": {"always_zero": 0, "w": 50, "h": 50, "cf": lv.img.CF.RAW_ALPHA},
|
||||
"data_size": 5158,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
void lv_example_rlottie_2(void)
|
||||
{
|
||||
/*The rlottie library uses STDIO file API, so there is no drievr letter for LVGL*/
|
||||
/*The rlottie library uses STDIO file API, so there is no driver letter for LVGL*/
|
||||
lv_obj_t * lottie = lv_rlottie_create_from_file(lv_scr_act(), 100, 100,
|
||||
"lvgl/examples/libs/rlottie/lv_example_rlottie_approve.json");
|
||||
lv_obj_center(lottie);
|
||||
|
||||
@@ -87,7 +87,7 @@ void lv_port_disp_init(void)
|
||||
/* Example for 3) also set disp_drv.full_refresh = 1 below*/
|
||||
static lv_disp_draw_buf_t draw_buf_dsc_3;
|
||||
static lv_color_t buf_3_1[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*A screen sized buffer*/
|
||||
static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*An other screen sized buffer*/
|
||||
static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*Another screen sized buffer*/
|
||||
lv_disp_draw_buf_init(&draw_buf_dsc_3, buf_3_1, buf_3_2, MY_DISP_VER_RES * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
||||
|
||||
/*-----------------------------------
|
||||
|
||||
@@ -52,7 +52,7 @@ style.set_shadow_color(lv.palette_darken(lv.PALETTE.BLUE, 1))
|
||||
style.set_transition(trans)
|
||||
|
||||
# Make the scrollbars wider and use 100% opacity when scrolled
|
||||
style_scrolled = lv.style_t()
|
||||
style_scrolled = lv.style_t()
|
||||
style_scrolled.init()
|
||||
style_scrolled.set_width(8)
|
||||
style_scrolled.set_bg_opa(lv.OPA.COVER)
|
||||
|
||||
@@ -7,7 +7,7 @@ props = [lv.STYLE.BG_COLOR, lv.STYLE.BORDER_COLOR, lv.STYLE.BORDER_WIDTH, 0]
|
||||
# A default transition
|
||||
# Make it fast (100ms) and start with some delay (200 ms)
|
||||
|
||||
trans_def = lv.style_transition_dsc_t()
|
||||
trans_def = lv.style_transition_dsc_t()
|
||||
trans_def.init(props, lv.anim_t.path_linear, 100, 200, None)
|
||||
|
||||
# A special transition when going to pressed state
|
||||
|
||||
@@ -36,7 +36,7 @@ void lv_example_style_11(void)
|
||||
lv_label_set_text(label, "Base");
|
||||
lv_obj_center(label);
|
||||
|
||||
/*Create an other object with the base style and earnings style too*/
|
||||
/*Create another object with the base style and earnings style too*/
|
||||
lv_obj_t * obj_warning = lv_obj_create(lv_scr_act());
|
||||
lv_obj_add_style(obj_warning, &style_base, 0);
|
||||
lv_obj_add_style(obj_warning, &style_warning, 0);
|
||||
|
||||
@@ -32,7 +32,7 @@ label = lv.label(obj_base)
|
||||
label.set_text("Base")
|
||||
label.center()
|
||||
|
||||
# Create an other object with the base style and earnings style too
|
||||
# Create another object with the base style and earnings style too
|
||||
obj_warning = lv.obj(lv.scr_act())
|
||||
obj_warning.add_style(style_base, 0)
|
||||
obj_warning.add_style(style_warning, 0)
|
||||
|
||||
@@ -32,7 +32,7 @@ static void new_theme_init_and_set(void)
|
||||
lv_theme_set_parent(&th_new, th_act);
|
||||
lv_theme_set_apply_cb(&th_new, new_theme_apply_cb);
|
||||
|
||||
/*Assign the new theme the the current display*/
|
||||
/*Assign the new theme to the current display*/
|
||||
lv_disp_set_theme(NULL, &th_new);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ def get_icon(filename,xres,yres):
|
||||
#
|
||||
|
||||
img_skew_strip_dsc = get_icon("img_skew_strip",80,20)
|
||||
style_indic = lv.style_t()
|
||||
style_indic = lv.style_t()
|
||||
|
||||
style_indic.init()
|
||||
style_indic.set_bg_img_src(img_skew_strip_dsc)
|
||||
|
||||
@@ -35,7 +35,7 @@ void lv_example_btn_2(void)
|
||||
static lv_style_t style_pr;
|
||||
lv_style_init(&style_pr);
|
||||
|
||||
/*Ad a large outline when pressed*/
|
||||
/*Add a large outline when pressed*/
|
||||
lv_style_set_outline_width(&style_pr, 30);
|
||||
lv_style_set_outline_opa(&style_pr, LV_OPA_TRANSP);
|
||||
|
||||
@@ -44,7 +44,7 @@ void lv_example_btn_2(void)
|
||||
lv_style_set_bg_color(&style_pr, lv_palette_darken(LV_PALETTE_BLUE, 2));
|
||||
lv_style_set_bg_grad_color(&style_pr, lv_palette_darken(LV_PALETTE_BLUE, 4));
|
||||
|
||||
/*Add a transition to the the outline*/
|
||||
/*Add a transition to the outline*/
|
||||
static lv_style_transition_dsc_t trans;
|
||||
static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, 0};
|
||||
lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, 300, 0, NULL);
|
||||
|
||||
@@ -40,7 +40,7 @@ style_pr.set_shadow_ofs_y(3)
|
||||
style_pr.set_bg_color(lv.palette_darken(lv.PALETTE.BLUE, 2))
|
||||
style_pr.set_bg_grad_color(lv.palette_darken(lv.PALETTE.BLUE, 4))
|
||||
|
||||
# Add a transition to the the outline
|
||||
# Add a transition to the outline
|
||||
trans = lv.style_transition_dsc_t()
|
||||
props = [lv.STYLE.OUTLINE_WIDTH, lv.STYLE.OUTLINE_OPA, 0]
|
||||
trans.init(props, lv.anim_t.path_linear, 300, 0, None)
|
||||
|
||||
@@ -60,7 +60,7 @@ static void event_cb(lv_event_t * e)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom drawer to the button matrix to customize butons one by one
|
||||
* Add custom drawer to the button matrix to customize buttons one by one
|
||||
*/
|
||||
void lv_example_btnmatrix_2(void)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ void lv_example_canvas_1(void)
|
||||
|
||||
lv_canvas_draw_text(canvas, 40, 20, 100, &label_dsc, "Some text on text canvas");
|
||||
|
||||
/*Test the rotation. It requires an other buffer where the orignal image is stored.
|
||||
/*Test the rotation. It requires another buffer where the original image is stored.
|
||||
*So copy the current image to buffer and rotate it to the canvas*/
|
||||
static lv_color_t cbuf_tmp[CANVAS_WIDTH * CANVAS_HEIGHT];
|
||||
memcpy(cbuf_tmp, cbuf, sizeof(cbuf_tmp));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
_CANVAS_WIDTH = 200
|
||||
_CANVAS_HEIGHT = 150
|
||||
_CANVAS_WIDTH = 200
|
||||
_CANVAS_HEIGHT = 150
|
||||
LV_IMG_ZOOM_NONE = 256
|
||||
|
||||
rect_dsc = lv.draw_rect_dsc_t()
|
||||
@@ -30,7 +30,7 @@ canvas.fill_bg(lv.palette_lighten(lv.PALETTE.GREY, 3), lv.OPA.COVER)
|
||||
canvas.draw_rect(70, 60, 100, 70, rect_dsc)
|
||||
canvas.draw_text(40, 20, 100, label_dsc, "Some text on text canvas")
|
||||
|
||||
# Test the rotation. It requires an other buffer where the original image is stored.
|
||||
# Test the rotation. It requires another buffer where the original image is stored.
|
||||
# So copy the current image to buffer and rotate it to the canvas
|
||||
|
||||
img = lv.img_dsc_t()
|
||||
|
||||
@@ -54,7 +54,7 @@ void lv_example_chart_3(void)
|
||||
lv_chart_set_next_value(chart, ser1, 22);
|
||||
lv_chart_set_next_value(chart, ser1, 58);
|
||||
|
||||
lv_coord_t * ser2_array = lv_chart_get_y_array(chart, ser2);
|
||||
lv_coord_t * ser2_array = lv_chart_get_y_array(chart, ser2);
|
||||
/*Directly set points on 'ser2'*/
|
||||
ser2_array[0] = 92;
|
||||
ser2_array[1] = 71;
|
||||
|
||||
@@ -46,7 +46,7 @@ chart.set_next_value(ser1, 22)
|
||||
chart.set_next_value(ser1, 58)
|
||||
|
||||
# Directly set points on 'ser2'
|
||||
ser2.y_points = [92,71,61,15,21,35,35,58,31,53,33,73]
|
||||
ser2.y_points = [92,71,61,15,21,35,35,58,31,53,33,73]
|
||||
|
||||
chart.refresh() #Required after direct set
|
||||
chart.refresh() # Required after direct set
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ static void draw_event_cb(lv_event_t *e)
|
||||
a.x1 = dsc->p1->x;
|
||||
a.x2 = dsc->p2->x;
|
||||
a.y1 = LV_MIN(dsc->p1->y, dsc->p2->y);
|
||||
a.y2 = obj->coords.y2 - 13; /* -13 cuts off where the rectangle draws over the chart margin. Without this an area of 0 doesnt look like 0 */
|
||||
a.y2 = obj->coords.y2 - 13; /* -13 cuts off where the rectangle draws over the chart margin. Without this an area of 0 doesn't look like 0 */
|
||||
lv_draw_rect(dsc->draw_ctx, &draw_rect_dsc, &a);
|
||||
|
||||
/*Remove the mask*/
|
||||
@@ -119,7 +119,7 @@ void lv_example_chart_8(void)
|
||||
|
||||
/* Draw to the series in the reverse order to which they were initialised.
|
||||
Without this the higher values will draw on top of the lower ones.
|
||||
This is because the Z-height of a series matches the order it was initialsied */
|
||||
This is because the Z-height of a series matches the order it was initialised */
|
||||
lv_chart_set_next_value(stacked_area_chart.obj, stacked_area_chart.series_list[3 - series_index - 1], draw_heights[series_index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ def draw_event_cb(e):
|
||||
a.x1 = dsc.p1.x
|
||||
a.x2 = dsc.p2.x
|
||||
a.y1 = min(dsc.p1.y, dsc.p2.y)
|
||||
a.y2 = cont_a.y2 - 13 # -13 cuts off where the rectangle draws over the chart margin. Without this an area of 0 doesnt look like 0
|
||||
a.y2 = cont_a.y2 - 13 # -13 cuts off where the rectangle draws over the chart margin. Without this an area of 0 doesn't look like 0
|
||||
lv.draw_rect(a, dsc.clip_area, draw_rect_dsc)
|
||||
|
||||
# Remove the mask
|
||||
@@ -116,7 +116,7 @@ def lv_example_chart_8():
|
||||
|
||||
# Draw to the series in the reverse order to which they were initialised.
|
||||
# Without this the higher values will draw on top of the lower ones.
|
||||
# This is because the Z-height of a series matches the order it was initialsied
|
||||
# This is because the Z-height of a series matches the order it was initialised
|
||||
stacked_area_chart.obj.set_next_value( stacked_area_chart.series_list[3 - series_index - 1], draw_heights[series_index])
|
||||
|
||||
stacked_area_chart.obj.refresh()
|
||||
|
||||
@@ -17,7 +17,7 @@ static void radio_event_handler(lv_event_t * e)
|
||||
if(act_cb == cont) return;
|
||||
|
||||
lv_obj_clear_state(old_cb, LV_STATE_CHECKED); /*Uncheck the previous radio button*/
|
||||
lv_obj_add_state(act_cb, LV_STATE_CHECKED); /*Uncheck the curernt radio button*/
|
||||
lv_obj_add_state(act_cb, LV_STATE_CHECKED); /*Uncheck the current radio button*/
|
||||
|
||||
*active_id = lv_obj_get_index(act_cb);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ void lv_example_meter_3(void)
|
||||
lv_meter_set_scale_ticks(meter, scale_min, 61, 1, 10, lv_palette_main(LV_PALETTE_GREY));
|
||||
lv_meter_set_scale_range(meter, scale_min, 0, 60, 360, 270);
|
||||
|
||||
/*Create an other scale for the hours. It's only visual and contains only major ticks*/
|
||||
/*Create another scale for the hours. It's only visual and contains only major ticks*/
|
||||
lv_meter_scale_t * scale_hour = lv_meter_add_scale(meter);
|
||||
lv_meter_set_scale_ticks(meter, scale_hour, 12, 0, 0, lv_palette_main(LV_PALETTE_GREY)); /*12 ticks*/
|
||||
lv_meter_set_scale_major_ticks(meter, scale_hour, 1, 2, 20, lv_color_black(), 10); /*Every tick is major*/
|
||||
|
||||
@@ -51,7 +51,7 @@ scale_min = meter.add_scale()
|
||||
meter.set_scale_ticks(scale_min, 61, 1, 10, lv.palette_main(lv.PALETTE.GREY))
|
||||
meter.set_scale_range(scale_min, 0, 60, 360, 270)
|
||||
|
||||
# Create an other scale for the hours. It's only visual and contains only major ticks
|
||||
# Create another scale for the hours. It's only visual and contains only major ticks
|
||||
scale_hour = meter.add_scale()
|
||||
meter.set_scale_ticks(scale_hour, 12, 0, 0, lv.palette_main(lv.PALETTE.GREY)) # 12 ticks
|
||||
meter.set_scale_major_ticks(scale_hour, 1, 2, 20, lv.color_black(), 10) # Every tick is major
|
||||
@@ -59,7 +59,7 @@ meter.set_scale_range(scale_hour, 1, 12, 330, 300) #
|
||||
|
||||
# LV_IMG_DECLARE(img_hand)
|
||||
|
||||
# Add a the hands from images
|
||||
# Add the hands from images
|
||||
indic_min = meter.add_needle_img(scale_min, img_hand_min_dsc, 5, 5)
|
||||
indic_hour = meter.add_needle_img(scale_min, img_hand_hour_dsc, 5, 5)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import fs_driver
|
||||
|
||||
|
||||
def event_handler(e):
|
||||
code = e.get_code()
|
||||
obj = e.get_target()
|
||||
@@ -13,7 +14,7 @@ def event_handler(e):
|
||||
#
|
||||
|
||||
# A style to make the selected option larger
|
||||
style_sel = lv.style_t()
|
||||
style_sel = lv.style_t()
|
||||
style_sel.init()
|
||||
|
||||
try:
|
||||
@@ -38,7 +39,7 @@ roller.align(lv.ALIGN.LEFT_MID, 10, 0)
|
||||
roller.add_event_cb(event_handler, lv.EVENT.ALL, None)
|
||||
roller.set_selected(2, lv.ANIM.OFF)
|
||||
|
||||
# A roller on the middle with center aligned text, and auto (default) width
|
||||
# A roller in the middle with center aligned text, and auto (default) width
|
||||
roller = lv.roller(lv.scr_act())
|
||||
roller.set_options(opts, lv.roller.MODE.NORMAL)
|
||||
roller.set_visible_row_count(3)
|
||||
@@ -57,4 +58,3 @@ roller.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0)
|
||||
roller.align(lv.ALIGN.RIGHT_MID, -10, 0)
|
||||
roller.add_event_cb(event_handler, lv.EVENT.ALL, None)
|
||||
roller.set_selected(8, lv.ANIM.OFF)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class Lv_Roller_3():
|
||||
#
|
||||
# Add a fade mask to roller.
|
||||
#
|
||||
style = lv.style_t()
|
||||
style = lv.style_t()
|
||||
style.init()
|
||||
style.set_bg_color(lv.color_black())
|
||||
style.set_text_color(lv.color_white())
|
||||
|
||||
@@ -7,7 +7,7 @@ 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_indicator = lv.style_t()
|
||||
style_knob = lv.style_t()
|
||||
style_pressed_color = lv.style_t()
|
||||
style_main.init()
|
||||
|
||||
@@ -48,6 +48,6 @@ table.set_cell_value(7, 1, "$9")
|
||||
table.set_height(200)
|
||||
table.center()
|
||||
|
||||
# Add an event callback to to apply some custom drawing
|
||||
# Add an event callback to apply some custom drawing
|
||||
table.add_event_cb(draw_part_event_cb, lv.EVENT.DRAW_PART_BEGIN, None)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ static void draw_event_cb(lv_event_t * e)
|
||||
lv_area_t sw_area;
|
||||
sw_area.x1 = dsc->draw_area->x2 - 50;
|
||||
sw_area.x2 = sw_area.x1 + 40;
|
||||
sw_area.y1 = dsc->draw_area->y1 + lv_area_get_height(dsc->draw_area) / 2 - 10;
|
||||
sw_area.y1 = dsc->draw_area->y1 + lv_area_get_height(dsc->draw_area) / 2 - 10;
|
||||
sw_area.y2 = sw_area.y1 + 20;
|
||||
lv_draw_rect(dsc->draw_ctx, &rect_dsc, &sw_area);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ for i in range(ITEM_CNT):
|
||||
|
||||
table.align(lv.ALIGN.CENTER, 0, -20)
|
||||
|
||||
# Add an event callback to to apply some custom drawing
|
||||
# Add an event callback to apply some custom drawing
|
||||
table.add_event_cb(draw_event_cb, lv.EVENT.DRAW_PART_END, None)
|
||||
table.add_event_cb(change_event_cb, lv.EVENT.VALUE_CHANGED, None)
|
||||
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
def textarea_event_handler(e,ta):
|
||||
def textarea_event_handler(e, ta):
|
||||
print("Enter was pressed. The current text is: " + ta.get_text())
|
||||
|
||||
def btnm_event_handler(e,ta):
|
||||
|
||||
|
||||
def btnm_event_handler(e, ta):
|
||||
obj = e.get_target()
|
||||
txt = obj.get_btn_text(obj.get_selected_btn())
|
||||
if txt == lv.SYMBOL.BACKSPACE:
|
||||
ta.del_char()
|
||||
elif txt == lv.SYMBOL.NEW_LINE:
|
||||
lv.event_send(ta,lv.EVENT.READY,None)
|
||||
lv.event_send(ta, lv.EVENT.READY, None)
|
||||
elif txt:
|
||||
ta.add_text(txt)
|
||||
|
||||
|
||||
ta = lv.textarea(lv.scr_act())
|
||||
ta.set_one_line(True)
|
||||
ta.align(lv.ALIGN.TOP_MID, 0, 10)
|
||||
ta.add_event_cb(lambda e: textarea_event_handler(e,ta), lv.EVENT.READY, None)
|
||||
ta.add_event_cb(lambda e: textarea_event_handler(e, ta), lv.EVENT.READY, None)
|
||||
ta.add_state(lv.STATE.FOCUSED) # To be sure the cursor is visible
|
||||
|
||||
btnm_map = ["1", "2", "3", "\n",
|
||||
@@ -26,7 +27,6 @@ btnm_map = ["1", "2", "3", "\n",
|
||||
btnm = lv.btnmatrix(lv.scr_act())
|
||||
btnm.set_size(200, 150)
|
||||
btnm.align(lv.ALIGN.BOTTOM_MID, 0, -10)
|
||||
btnm.add_event_cb(lambda e: btnm_event_handler(e,ta), lv.EVENT.VALUE_CHANGED, None)
|
||||
btnm.add_event_cb(lambda e: btnm_event_handler(e, ta), lv.EVENT.VALUE_CHANGED, None)
|
||||
btnm.clear_flag(lv.obj.FLAG.CLICK_FOCUSABLE) # To keep the text area focused on button clicks
|
||||
btnm.set_map(btnm_map)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/**
|
||||
* Create a 2x2 tile view and allow scrolling only in an "L" shape.
|
||||
* Demonstrate scroll chaining with a long list that
|
||||
* scrolls the tile view when it cant't be scrolled further.
|
||||
* scrolls the tile view when it can't be scrolled further.
|
||||
*/
|
||||
void lv_example_tileview_1(void)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ void lv_example_tileview_1(void)
|
||||
lv_obj_center(btn);
|
||||
|
||||
/*Tile3: a list*/
|
||||
lv_obj_t * tile3 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_LEFT);
|
||||
lv_obj_t * tile3 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_LEFT);
|
||||
lv_obj_t * list = lv_list_create(tile3);
|
||||
lv_obj_set_size(list, LV_PCT(100), LV_PCT(100));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Create a 2x2 tile view and allow scrolling only in an "L" shape.
|
||||
# Demonstrate scroll chaining with a long list that
|
||||
# scrolls the tile view when it cant't be scrolled further.
|
||||
# scrolls the tile view when it can't be scrolled further.
|
||||
#
|
||||
tv = lv.tileview(lv.scr_act())
|
||||
|
||||
@@ -23,7 +23,7 @@ btn.set_size(lv.SIZE.CONTENT, lv.SIZE.CONTENT)
|
||||
btn.center()
|
||||
|
||||
# Tile3: a list
|
||||
tile3 = tv.add_tile(1, 1, lv.DIR.LEFT)
|
||||
tile3 = tv.add_tile(1, 1, lv.DIR.LEFT)
|
||||
list = lv.list(tile3)
|
||||
list.set_size(lv.pct(100), lv.pct(100))
|
||||
|
||||
@@ -37,4 +37,3 @@ list.add_btn(None, "Seven")
|
||||
list.add_btn(None, "Eight")
|
||||
list.add_btn(None, "Nine")
|
||||
list.add_btn(None, "Ten")
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ void lv_example_win_1(void)
|
||||
btn = lv_win_add_btn(win, LV_SYMBOL_CLOSE, 60);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
|
||||
lv_obj_t * cont = lv_win_get_content(win); /*Content can be aded here*/
|
||||
lv_obj_t * label = lv_label_create(cont);
|
||||
lv_obj_t * cont = lv_win_get_content(win); /*Content can be added here*/
|
||||
lv_obj_t * label = lv_label_create(cont);
|
||||
lv_label_set_text(label, "This is\n"
|
||||
"a pretty\n"
|
||||
"long text\n"
|
||||
|
||||
@@ -4,17 +4,18 @@ def event_handler(e):
|
||||
if code == lv.EVENT.CLICKED:
|
||||
print("Button {:d} clicked".format(obj.get_child_id()))
|
||||
|
||||
|
||||
win = lv.win(lv.scr_act(), 60)
|
||||
btn1 = win.add_btn(lv.SYMBOL.LEFT, 40)
|
||||
btn1.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
btn1.add_event_cb(event_handler, lv.EVENT.ALL, None)
|
||||
win.add_title("A title")
|
||||
btn2=win.add_btn(lv.SYMBOL.RIGHT, 40)
|
||||
btn2.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
btn2.add_event_cb(event_handler, lv.EVENT.ALL, None)
|
||||
btn3 = win.add_btn(lv.SYMBOL.CLOSE, 60)
|
||||
btn3.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
btn3.add_event_cb(event_handler, lv.EVENT.ALL, None)
|
||||
|
||||
cont = win.get_content() #Content can be aded here
|
||||
label = lv.label(cont)
|
||||
cont = win.get_content() # Content can be added here
|
||||
label = lv.label(cont)
|
||||
label.set_text("""This is
|
||||
a pretty
|
||||
long text
|
||||
@@ -33,4 +34,3 @@ text to be
|
||||
sure it
|
||||
overflows.
|
||||
""")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user