「App:Library:LVGL:Readme:Examples」の版間の差分

提供: robot-jp wiki
ナビゲーションに移動検索に移動
 
(同じ利用者による、間の17版が非表示)
1行目: 1行目:
 
https://github.com/lvgl/lvgl#examples
 
https://github.com/lvgl/lvgl#examples
 +
 +
== Examples ==
 
__NOTOC__
 
__NOTOC__
 
:{| class="wikitable"
 
:{| class="wikitable"
5行目: 7行目:
 
!自動翻訳
 
!自動翻訳
 
|-
 
|-
|
+
|For more examples see the <u>'''[https://github.com/lvgl/lvgl/tree/master/examples examples]'''</u> folder.
|
+
|その他の例については、 '''<u>[https://github.com/lvgl/lvgl/tree/master/examples examples]</u>'''フォルダーを参照してください。
|-
+
|}
|
+
:[[ファイル:LVGL Readme btn example.png]]
|
+
 
|-
+
=== ‎C ===
|
+
:<syntaxhighlight lang="C++" style="border: 1px dashed gray;">
|
+
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_size(btn, 100, 50);                                  /*Set its size*/
|
+
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
|-
+
 
|
+
lv_obj_t * label = lv_label_create(btn);                        /*Add a label to the button*/
|
+
lv_label_set_text(label, "Button");                            /*Set the labels text*/
|-
+
lv_obj_center(label);                                          /*Align the label to the center*/
|
+
...
|
+
 
|-
+
void btn_event_cb(lv_event_t * e)
|
+
{
|
+
  printf("Clicked\n");
|-
+
}
|
+
‎</syntaxhighlight>
|
+
 
 +
=== Micropython ===
 +
:{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-  
 +
|Learn more about [https://docs.lvgl.io/master/get-started/bindings/micropython.html Micropython].
 +
|[https://docs.lvgl.io/master/get-started/bindings/micropython.html Micropython]の詳細をご覧ください。
 
|}
 
|}
:[https://robot-jp.com/wiki/index.php/App:Library:LVGL 戻る : Previous]
+
:<syntaxhighlight lang="python" style="border: 1px dashed gray;">
 +
def btn_event_cb(e):
 +
  print("Clicked")
 +
 
 +
# Create a Button and a Label
 +
btn = lv.btn(lv.scr_act())
 +
btn.set_pos(10, 10)
 +
btn.set_size(100, 50)
 +
btn.add_event_cb(btn_event_cb, lv.EVENT.CLICKED, None)
 +
 
 +
label = lv.label(btn)
 +
label.set_text("Button")
 +
label.center()
 +
‎</syntaxhighlight>
 +
 
 +
 
 +
[https://robot-jp.com/wiki/index.php/App:Library:LVGL 戻る : Previous]

2022年6月23日 (木) 00:14時点における最新版

https://github.com/lvgl/lvgl#examples

Examples

英文 自動翻訳
For more examples see the examples folder. その他の例については、 examplesフォルダーを参照してください。
LVGL Readme btn example.png

‎C

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_size(btn, 100, 50);                                  /*Set its size*/
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/

lv_obj_t * label = lv_label_create(btn);                        /*Add a label to the button*/
lv_label_set_text(label, "Button");                             /*Set the labels text*/
lv_obj_center(label);                                           /*Align the label to the center*/
...

void btn_event_cb(lv_event_t * e)
{
  printf("Clicked\n");
}

Micropython

英文 自動翻訳
Learn more about Micropython. Micropythonの詳細をご覧ください。
def btn_event_cb(e):
  print("Clicked")

# Create a Button and a Label
btn = lv.btn(lv.scr_act())
btn.set_pos(10, 10)
btn.set_size(100, 50)
btn.add_event_cb(btn_event_cb, lv.EVENT.CLICKED, None)

label = lv.label(btn)
label.set_text("Button")
label.center()


戻る : Previous