当前位置:首页 > 项目 > Wpython > 正文内容

micropython文本编辑器 界面

watrt4个月前 (12-25)Wpython1490
##### startup script #####

#!/opt/bin/lv_micropython -i

import lvgl as lv

import display_driver


##### main script #####

import fs_driver
fs_drv = lv.fs_drv_t()
fs_driver.fs_register(fs_drv, 'S')
font_simsun_st12 = lv.font_load("S:st12.font")

def event_handler(e):
    code = e.get_code()
    obj = e.get_target()
    if code == lv.EVENT.CLICKED:
        print("Button {:d} clicked".format(obj.get_child_id()))


win = lv.win(lv.scr_act(), 60)

win.add_title("A title")
btn1 = win.add_btn(lv.SYMBOL.FILE, 40)
btn1.add_event_cb(event_handler, lv.EVENT.ALL, None)
btn2=win.add_btn(lv.SYMBOL.SAVE, 40)
btn2.add_event_cb(event_handler, lv.EVENT.ALL, None)
btn3 = win.add_btn(lv.SYMBOL.CLOSE, 40)
btn3.add_event_cb(event_handler, lv.EVENT.ALL, None)

cont = win.get_content()  # Content can be added here
cont.set_style_pad_all(lv.STATE.DEFAULT,0)
ta = lv.textarea(cont)
ta.set_width(cont.get_width())
ta.set_height(cont.get_height())
ta.set_style_text_font(font_simsun_st12, 0)
ta.set_text("""This is
a pretty
long text
to see how
the window
becomes
scrollable.
你好

We need
quite some text
and we will
even put
some more
text to be
sure it
overflows.
""")

QQ截图20231225162034.jpg

分享给朋友:

相关文章

wpython_GUI 1.6板子回来了

wpython_GUI 1.6板子回来了

板子打出来了。小的元件已经SMT好了,大的元件我已经自己手焊好了,先给大家看看样板两个LED因为出于成本的原因是单面贴,双面太贵了,而且感觉不重要就先没有焊正面,大体算正常吧,但是也现在了两个BUG,还是缺少经验。1、ESP32的IO36脚和IO39脚,只支持输入模式,而且没有内部上拉,所以要外挂上拉,这点在画板的时间 没有想到。目前使用的是补焊两个电阻补救上(KEY_A、KEY_B)。2、还有一个就是屏的背景使用的是S8050当做背光开关,结果发现在虽然可以过通IO来控制引脚,但是背景电压太低...

micrpython编译javascript版

micrpython编译javascript版

1、首先安装emsdkgit clone https://github.com/emscripten-core/emsdk.git cd <path-to-emsdk> git pull ./emsdk install latest ./emsdk activate latest source ./emsdk_env.sh2、获取micropython源码git clone&...

LVGL_micropython 模拟器

LVGL_micropython 模拟器

在使用micropython编写lvgl界面时有时间非常的麻烦。要在设备上才看得到效果。比较麻烦。npx的GUI-Guider软件中的模拟器给抠出来了单独使用,非常不错。下面是运行实例:import SDL import utime as time import usys as sys import lvgl as lv import lodepng as p...

micropython 实现tar 文件解包

micropython 实现tar 文件解包

import upip_utarfile as tar import os def run(src,dest_dir):   t = tar.TarFile(src)   if not dest_dir in os.listdir():     os.mkdir(dest_dir)  ...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。