from nicegui import ui
from nicegui_toolkit import inject_layout_tool
# Just call it once
inject_layout_tool()
ui.label("label")
ui.label("label with style").style("width:80%;")
with ui.card(), ui.card().style(""):
ui.input("user name", placeholder="enter your name:")
ui.label("xxxx").style("width:500px;")
ui.input("password", placeholder="enter your password:").style(
"font-size:1.7rem;color:#a12d2d"
)
ui.run()
run cmd
python toolkit_demo.py
output
(.env) C:\Users\Lenovo\Desktop\work\py\nicegui_demo>python toolkit_demo.py
Traceback (most recent call last):
File "C:\Users\Lenovo\Desktop\work\py\nicegui_demo\toolkit_demo.py", line 1, in <module>
from nicegui import ui
File "C:\Users\Lenovo\Desktop\work\py\.env\lib\site-packages\nicegui\__init__.py", line 1, in <module>
from . import elements, run, ui
File "C:\Users\Lenovo\Desktop\work\py\.env\lib\site-packages\nicegui\ui.py", line 167, in <module>
from .elements.joystick import Joystick as joystick
File "C:\Users\Lenovo\Desktop\work\py\.env\lib\site-packages\nicegui\elements\joystick.py", line 9, in <module>
class Joystick(Element, component='joystick.vue', dependencies=['lib/nipplejs/nipplejs.js']):
File "C:\Users\Lenovo\Desktop\work\py\.env\lib\site-packages\nicegui\element.py", line 116, in __init_subclass__
cls.component = register_vue_component(path)
File "C:\Users\Lenovo\Desktop\work\py\.env\lib\site-packages\nicegui\dependencies.py", line 74, in register_vue_component
v = vbuild.VBuild(path.name, path.read_text())
File "D:\python\lib\pathlib.py", line 1135, in read_text
return f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 46: illegal multibyte sequence
linux is ok, window error
install cmd
toolkit_demo.py
run cmd
output