docs(micropython): update MicroPython examples in documentation (#5622)
This commit is contained in:
@@ -352,14 +352,14 @@ Learn more about :ref:`micropython`.
|
|||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
|
# Initialize
|
||||||
|
import display_driver
|
||||||
import lvgl as lv
|
import lvgl as lv
|
||||||
|
|
||||||
# Create a Button and a Label
|
# Create a button with a label
|
||||||
scr = lv.obj()
|
scr = lv.obj()
|
||||||
btn = lv.btn(scr)
|
btn = lv.button(scr)
|
||||||
btn.align(lv.screen_active(), lv.ALIGN.CENTER, 0, 0)
|
btn.align(lv.ALIGN.CENTER, 0, 0)
|
||||||
label = lv.label(btn)
|
label = lv.label(btn)
|
||||||
label.set_text("Button")
|
label.set_text('Hello World!')
|
||||||
|
|
||||||
# Load the screen
|
|
||||||
lv.screen_load(scr)
|
lv.screen_load(scr)
|
||||||
|
|||||||
@@ -81,10 +81,13 @@ A simple example
|
|||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
|
# Initialize
|
||||||
|
import display_driver
|
||||||
import lvgl as lv
|
import lvgl as lv
|
||||||
lv.init()
|
|
||||||
|
# Create a button with a label
|
||||||
scr = lv.obj()
|
scr = lv.obj()
|
||||||
btn = lv.btn(scr)
|
btn = lv.button(scr)
|
||||||
btn.align(lv.ALIGN.CENTER, 0, 0)
|
btn.align(lv.ALIGN.CENTER, 0, 0)
|
||||||
label = lv.label(btn)
|
label = lv.label(btn)
|
||||||
label.set_text('Hello World!')
|
label.set_text('Hello World!')
|
||||||
|
|||||||
Reference in New Issue
Block a user