前板第一次提交
This commit is contained in:
7
lvgl_v8_front/lvgl/examples/widgets/line/index.rst
Executable file
7
lvgl_v8_front/lvgl/examples/widgets/line/index.rst
Executable file
@@ -0,0 +1,7 @@
|
||||
|
||||
Simple Line
|
||||
""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/line/lv_example_line_1
|
||||
:language: c
|
||||
|
||||
24
lvgl_v8_front/lvgl/examples/widgets/line/lv_example_line_1.c
Executable file
24
lvgl_v8_front/lvgl/examples/widgets/line/lv_example_line_1.c
Executable file
@@ -0,0 +1,24 @@
|
||||
#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(&style_line);
|
||||
lv_style_set_line_width(&style_line, 8);
|
||||
lv_style_set_line_color(&style_line, lv_palette_main(LV_PALETTE_BLUE));
|
||||
lv_style_set_line_rounded(&style_line, true);
|
||||
|
||||
/*Create a line and apply the new style*/
|
||||
lv_obj_t * line1;
|
||||
line1 = lv_line_create(lv_scr_act());
|
||||
lv_line_set_points(line1, line_points, 5); /*Set the points*/
|
||||
lv_obj_add_style(line1, &style_line, 0);
|
||||
lv_obj_center(line1);
|
||||
}
|
||||
|
||||
#endif
|
||||
20
lvgl_v8_front/lvgl/examples/widgets/line/lv_example_line_1.py
Executable file
20
lvgl_v8_front/lvgl/examples/widgets/line/lv_example_line_1.py
Executable file
@@ -0,0 +1,20 @@
|
||||
# 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.set_line_color(lv.palette_main(lv.PALETTE.BLUE))
|
||||
style_line.set_line_rounded(True)
|
||||
|
||||
# Create a line and apply the new style
|
||||
line1 = lv.line(lv.scr_act())
|
||||
line1.set_points(line_points, 5) # Set the points
|
||||
line1.add_style(style_line, 0)
|
||||
line1.center()
|
||||
|
||||
Reference in New Issue
Block a user