「App:Library:LVGL:Readme:Examples」の版間の差分
提供: robot-jp wiki
ナビゲーションに移動検索に移動11行目: | 11行目: | ||
|} | |} | ||
:[[ファイル:LVGL Readme btn example.png]] | :[[ファイル:LVGL Readme btn example.png]] | ||
− | + | C<syntaxhighlight lang="C++" line> | |
lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button to the current screen*/ | lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button to the current screen*/ | ||
lv_obj_set_pos(btn, 10, 10); /*Set its position*/ | lv_obj_set_pos(btn, 10, 10); /*Set its position*/ | ||
28行目: | 28行目: | ||
− | </syntaxhighlight> | + | </syntaxhighlight>Micropython |
+ | |||
+ | |||
:[https://robot-jp.com/wiki/index.php/App:Library:LVGL 戻る : Previous] | :[https://robot-jp.com/wiki/index.php/App:Library:LVGL 戻る : Previous] |
2022年6月20日 (月) 22:25時点における版
https://github.com/lvgl/lvgl#examples
Examples
C
1lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button to the current screen*/
2lv_obj_set_pos(btn, 10, 10); /*Set its position*/
3lv_obj_set_size(btn, 100, 50); /*Set its size*/
4lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
5
6lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/
7lv_label_set_text(label, "Button"); /*Set the labels text*/
8lv_obj_center(label); /*Align the label to the center*/
9...
10
11void btn_event_cb(lv_event_t * e)
12{
13 printf("Clicked\n");
14}
15
16
17
Micropython