1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

docs(micropython): update MicroPython examples in documentation (#5622)

This commit is contained in:
PGNetHun 2024-02-07 21:57:51 +01:00 committed by GitHub
parent abd3490a26
commit bc7d95c628
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 8 deletions

View File

@ -352,14 +352,14 @@ Learn more about :ref:`micropython`.
.. code:: python
# Initialize
import display_driver
import lvgl as lv
# Create a Button and a Label
# Create a button with a label
scr = lv.obj()
btn = lv.btn(scr)
btn.align(lv.screen_active(), lv.ALIGN.CENTER, 0, 0)
btn = lv.button(scr)
btn.align(lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text("Button")
# Load the screen
label.set_text('Hello World!')
lv.screen_load(scr)

View File

@ -81,10 +81,13 @@ A simple example
.. code:: python
# Initialize
import display_driver
import lvgl as lv
lv.init()
# Create a button with a label
scr = lv.obj()
btn = lv.btn(scr)
btn = lv.button(scr)
btn.align(lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text('Hello World!')