{"id":18301437,"url":"https://github.com/lvgl/lv_binding_pikascript","last_synced_at":"2026-03-01T16:34:14.663Z","repository":{"id":57838318,"uuid":"528381319","full_name":"lvgl/lv_binding_pikascript","owner":"lvgl","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-26T13:17:54.000Z","size":41654,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T14:35:02.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lvgl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-24T10:53:05.000Z","updated_at":"2025-01-14T03:37:41.000Z","dependencies_parsed_at":"2023-01-20T12:45:37.036Z","dependency_job_id":null,"html_url":"https://github.com/lvgl/lv_binding_pikascript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lvgl/lv_binding_pikascript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_pikascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_pikascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_pikascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_pikascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lvgl","download_url":"https://codeload.github.com/lvgl/lv_binding_pikascript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_binding_pikascript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29974747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:18:32.386Z","status":"ssl_error","status_checked_at":"2026-03-01T16:18:04.258Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T15:15:56.773Z","updated_at":"2026-03-01T16:34:14.648Z","avatar_url":"https://github.com/lvgl.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿This Repo is Forked from https://github.com/lvgl/lv_port_win_visual_studio\n\n# What is PikaScript ?\n\n[PikaScript](https://github.com/pikastech/pikascript) is a Python interpreter designed specifically for microcontrollers, and it supports a subset of the common Python3 syntax.\n\nIt's lighter, requiring only 32k of code space and 4k of RAM, which means it can run on stm32f103c8 (blue-pile) or even stm32f030c8, on the other hand, you can leave valuable space for more material or build larger buffer areas.\n\nIt is simpler, out of the box, runs with no porting and configuration at all, does not depend on OS and file system, has good support for popular IDEs for Windows platforms like Keil, IAR, RT-Thread-Studio, and of course, supports linux-gcc development platforms.\n\nIt's smarter, with a unique C module mechanism that allows you to generate bindings automatically by simply writing the API for the C module in Python, and you don't need to deal with the headache of writing any macros or global tables manually. On the other hand, all C modules have sophisticated smart hints, even hinting at the types of your arguments .\n\n---\n\n# Why PikaScript + LVGL ?\n\nPikaScript now supports the main features of LVGL8, and these APIs are fully compatible with Micropython!\n\nThis means that you can continue to use already written code from Micropython, and then use less code space and RAM.\n\nThe peak memory footprint of the ring animation DEMO is just 6.56kB\n\n![image-20220824182245355](assets/image-20220824182245355.png)\n\nEnjoy detailed code hints down to the parameter type for a better programming experience\n\n![image-20220824182016851](assets/image-20220824182016851.png)\n\nUse a more convenient IDE, such as vs-based simulation projects\n\n![image-20220824182617455](assets/image-20220824182617455.png)\n\n# So how does it look like?\n\nHere are some examples of lvgl that PikaScript can already run, they are mainly from the lvgl documentation examples\n\n## LV_ARC\n\n```python\nimport pika_lvgl as lv\nimport PikaStdLib\nmem = PikaStdLib.MemChecker()\n\n# Create an Arc\narc = lv.arc(lv.scr_act())\narc.set_end_angle(200)\narc.set_size(150, 150)\narc.center()\n\nprint('mem used max: %0.2f kB' % (mem.getMax()))\nprint('mem used now: %0.2f kB' % (mem.getNow()))\n\n```\n\n![image-20220824183104434](assets/image-20220824183104434.png)\n\n## LV_BAR\n\n``` python\nimport pika_lvgl as lv\nimport PikaStdLib\nmem = PikaStdLib.MemChecker()\n\nbar1 = lv.bar(lv.scr_act())\nbar1.set_size(200, 20)\nbar1.center()\nbar1.set_value(70, lv.ANIM.OFF)\n\nprint('mem used max: %0.2f kB' % (mem.getMax()))\nprint('mem used now: %0.2f kB' % (mem.getNow()))\n```\n\n![image-20220824183329609](assets/image-20220824183329609.png)\n\n## LV_BTN\n\n``` python\nimport pika_lvgl as lv\nimport PikaStdLib\nmem = PikaStdLib.MemChecker()\n\n\ndef event_cb_1(evt):\n    print('in evt1')\n    print('mem used now: %0.2f kB' % (mem.getNow()))\n\n\ndef event_cb_2(evt):\n    print('in evt2')\n    print('mem used now: %0.2f kB' % (mem.getNow()))\n\n\nbtn1 = lv.btn(lv.scr_act())\nbtn1.align(lv.ALIGN.TOP_MID, 0, 10)\nbtn2 = lv.btn(lv.scr_act())\nbtn2.align(lv.ALIGN.TOP_MID, 0, 50)\nbtn1.add_event_cb(event_cb_1, lv.EVENT.CLICKED, 0)\nbtn2.add_event_cb(event_cb_2, lv.EVENT.CLICKED, 0)\n\nprint('mem used max: %0.2f kB' % (mem.getMax()))\nprint('mem used now: %0.2f kB' % (mem.getNow()))\n```\n\n![image-20220824183435088](assets/image-20220824183435088.png)\n\n## LV_CHECKBOX\n\n``` python\nimport pika_lvgl as lv\nimport PikaStdLib\nmem = PikaStdLib.MemChecker()\n\ncb = lv.checkbox(lv.scr_act())\ncb.set_text(\"Apple\")\ncb.align(lv.ALIGN.TOP_LEFT, 0 ,0)\n\ncb = lv.checkbox(lv.scr_act())\ncb.set_text(\"Banana\")\ncb.add_state(lv.STATE.CHECKED)\ncb.align(lv.ALIGN.TOP_LEFT, 0 ,30)\n\ncb = lv.checkbox(lv.scr_act())\ncb.set_text(\"Lemon\")\ncb.add_state(lv.STATE.DISABLED)\ncb.align(lv.ALIGN.TOP_LEFT, 0 ,60)\n\ncb = lv.checkbox(lv.scr_act())\ncb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)\ncb.set_text(\"Melon\")\ncb.align(lv.ALIGN.TOP_LEFT, 0 ,90)\n\nprint('mem used max: %0.2f kB' % (mem.getMax()))\nprint('mem used now: %0.2f kB' % (mem.getNow()))\n```\n\n![image-20220824183607357](assets/image-20220824183607357.png)\n\n## LV_DRAG\n\n``` python\nimport pika_lvgl as lv\nfrom PikaStdLib import MemChecker\n\nmem = MemChecker()\n\ndef drag_event_handler(e):\n\n    obj = e.get_target()\n\n    indev = lv.indev_get_act()\n\n    vect = lv.point_t()\n    indev.get_vect(vect)\n    x = obj.get_x() + vect.x\n    y = obj.get_y() + vect.y\n    obj.set_pos(x, y)\n    mem.now()\n\n\n#\n# Make an object dragable.\n#\n\nobj = lv.obj(lv.scr_act())\nobj.set_size(150, 100)\nobj.add_event_cb(drag_event_handler, lv.EVENT.PRESSING, None)\n\nlabel = lv.label(obj)\nlabel.set_text(\"Drag me\")\nlabel.center()\n\n```\n\n![image-20220824183709013](assets/image-20220824183709013.png)\n\n## LV_LABEL\n\n``` python\nimport pika_lvgl as lv\nimport PikaStdLib\nmem = PikaStdLib.MemChecker()\n\nlabel1 = lv.label(lv.scr_act())\nLV_LABEL_LONG_WRAP = 0\nlabel1.set_long_mode(LV_LABEL_LONG_WRAP)      # Break the long lines*/\n# Enable re-coloring by commands in the text\nlabel1.set_recolor(True)\nlabel1.set_text(\"#0000ff Re-color# #ff00ff words# #ff0000 of a# label, \\\nalign the lines to the center and  wrap long text automatically.\")\n# Set smaller width to make the lines wrap\nlabel1.set_width(150)\nlabel1.set_style_text_align(lv.ALIGN.CENTER, 0)\nlabel1.align(lv.ALIGN.CENTER, 0, -40)\n\nLV_LABEL_LONG_SCROLL_CIRCULAR = 3\nlabel2 = lv.label(lv.scr_act())\nlabel2.set_long_mode(LV_LABEL_LONG_SCROLL_CIRCULAR)  # Circular scroll\nlabel2.set_width(150)\nlabel2.set_text(\"It is a circularly scrolling text. \")\nlabel2.align(lv.ALIGN.CENTER, 0, 40)\n\nprint('mem used max: %0.2f kB' % (mem.getMax()))\nprint('mem used now: %0.2f kB' % (mem.getNow()))\n\n```\n\n![image-20220824183806910](assets/image-20220824183806910.png)\n\n---\n\n# How does it work?\n\nPikaScript has a unique C module smart binding tool\n\nJust write the Python interface in pika_lvgl.pyi (.pyi is the python interface file)\n\n``` python\n# pika_lvgl.pyi\nclass arc(lv_obj):\n    def set_end_angle(self, angle: int): ...\n    def set_bg_angles(self, start: int, end: int): ...\n    def set_angles(self, start: int, end: int): ...\n```\n\nThen PikaScript's pre-compiler can automatically bind the following C functions, simply by naming the functions in the module_class_method format, without any additional work, and all binding and registration is done automatically.\n\n``` C\n/* pika_lvgl_arc.c */\nvoid pika_lvgl_arc_set_end_angle(PikaObj* self, int angle) {\n    lv_obj_t* lv_obj = obj_getPtr(self, \"lv_obj\");\n    lv_arc_set_end_angle(lv_obj, angle);\n}\n\nvoid pika_lvgl_arc_set_bg_angles(PikaObj *self, int start, int end){\n    lv_obj_t* lv_obj = obj_getPtr(self, \"lv_obj\");\n    lv_arc_set_bg_angles(lv_obj, start, end);\n}\n\nvoid pika_lvgl_arc_set_angles(PikaObj *self, int start, int end){\n    lv_obj_t* lv_obj = obj_getPtr(self, \"lv_obj\");\n    lv_arc_set_angles(lv_obj, start, end);\n}\n```\n\nTo use the module, just `import pika_lvgl` and the precompiler will automatically scan main.py and bind the `pika_lvgl` module\n\n```\n$ ./rust-msc-latest-win10.exe \n(pikascript) packages installed:\n    pikascript-core==v1.10.0\n    PikaStdLib==v1.10.0\n    PikaStdDevice==v1.10.0\n\n(pikascript) pika compiler:\n  scaning main.py...\n    binding pika_lvgl.pyi...\n```\n\nThe precompiler is written in Rust, runs on windows and linux, and is completely open source.\n\nIn addition to binding C modules, the precompiler compiles Python scripts to bytecode in the PC, reducing the size of the script and increasing its speed.\n\n---\n\n# The original README\n\n![Screenshot](Screenshot.png)\n\n## Introduction\n\nThis is a pre-configured Visual Studio project to try LVGL on a Windows PC. The\nproject only depend on Win32 API, C Runtime and C++ STL, so you can compile it\nwithout any extra dependencies.\n\nThe project is currently maintained using Visual Studio 2019. It may well work\nwithout modification in Visual Studio 2017 but it is not actively supported \nwith that version, so please install and test with Visual Studio 2019 before \nreporting any bugs.\n\nSome one will notice that this repository had been renamed from \n`lv_sim_visual_studio_sdl` to `lv_sim_visual_studio`. You can read \n[here](https://github.com/lvgl/lvgl/issues/2043) and know why.\n\n**This project is not for Visual Studio Code, it is for Visual Studio 2019.**\n\nInstructions for cloning, building and running the application are found below.\n\n## Known Issues\n\n- The LV_MEM_SIZE macro in lv_conf.h should be 128KiB or larger because you may\n  meet the out of memory issue when you are using the 64-bit simulator.\n  - Note: In this project, the size is set to 1024KiB.\n- Users need to check the target selected in Visual Studio, because the \n  simulator project support ARM64 and Visual Studio will choose ARM64 in the \n  first time because of the alphabetical order.\n\n## Supported Features\n\nThis repo is designed for keeping the simulator behavior. If you wonder to \nadapt your LVGL application to Windows, please visit \n[lvgl/lv_port_windows](https://github.com/lvgl/lv_port_windows).\n\n- [x] Only depends on Win32 API, C Runtime and C++ STL.\n- [x] Native support for x86, x64 and ARM64 Windows.\n- [x] Support compiling with [VC-LTL](https://github.com/Chuyu-Team/VC-LTL) \n      toolchain to make the binary size as smaller as using MinGW.\n- [x] Support Per-monitor DPI Aware.\n- [x] Support Windows keyboard and mouse wheel event in the HAL level.\n- [x] FreeType integration.\n\n## Drop the ARM32 Windows support\n\nFor my deliberate consideration, The lv_port_windows project will drop the ARM32\nsupport on the Windows platform. Here are the reasons:\n\n- The latest version of ARM32 version for Windows desktop is Redstone 2 Insider\n  Build 15035. I know Windows RT 8.1 and Windows 10 IoT Core aren't in the \n  stage of end of support, but most of daily users are drop their devices \n  (Windows RT 8.x tablets) or have a better solution (Windows 10 IoT Core users\n  on Raspberry Pi devices should migrate to Linux or ARM64 version for Windows \n  10 desktop).\n- Future ARM processors are deprecating ARM32 ISA support, and Apple Silicon M1\n  had dropped the ARM32 support at all. So we can't run ARM32 version of Windows\n  desktop applications on these devices.\n- Reduce the size of release package and make the continuous integration faster.\n\n## How to Clone\n\nThis repository contains other, necessary LVGL software repositories as \n[git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules). Those \nsubmodules are not pulled in with the normal git clone command and they will be\nneeded. There are a couple of techniques to pull in the submodules.\n\n### Everything at Once\n\nThis command will clone the lv_sim_visual_studio repository and all submodules\nin a single step.\n\n```\ngit clone --recurse-submodules https://github.com/lvgl/lv_sim_visual_studio.git\n```\n\n### Main Repository First, Submodules Second\n\nIf you've already cloned the main repository you can pull in the submodules \nwith a second command. Both commands are shown below.\n\n```\ngit clone https://github.com/lvgl/lv_sim_visual_studio.git\ncd lv_sim_visual_studio\ngit submodule update --init --recursive\n```\n\n### Keeping Your Clone Up-To-Date\n\nIf you have cloned this repository and would like to pull in the latest \nchanges, you will have to do this in two steps. The first step will pull in\nupdates to the main repo, including updated _references_ to the submodules. The\nsecond step will update the code in the submodules to match those references.\nThe two commands needed to accomplish this are shown below, run these commands\nfrom inside the main repository's directory (top level `lv_sim_visual_studio`\ndirectory works fine).\n\n```\ngit pull\ngit submodule update --init --recursive\n```\n\nIf you have chosen to fork this repository then updating the fork from upstream\nwill require a different, more involved procedure.\n\n## How To Build \u0026 Run\n\nOpen the `LVGL.Simulator.sln` solution file in Visual Studio. Set the \n`LVGL.Simulator` project as the startup project. Click on the `Local Windows\nDebugger` button in the top toolbar.  The included project will be built and \nrun, launching from a cmd window.\n\n## Trying Things Out\n\nThere are a list of possible test applications in the \n[LVGL.Simulator.cpp](LVGL.Simulator/LVGL.Simulator.cpp) file. Each test or demo\nis launched via a single function call.  By default the `lv_demo_widgets` \nfunction is the one that runs, but you can comment that one out and choose any\nof the others to compile and run.\n\nUse these examples to start building your own application test code inside the\nsimulator.\n\n## A Note About Versions\n\nThis repository has its submodule references updated shortly afk with minor \nversion updates. When submodule updates take place a matching version tag is\nadded tter the release of new, major releases of LittlevGL's core \n[lvgl](https://github.com/lvgl/lvgl) project. Occasionally it is updated to\nworo this repository.\n\nIf you need to pull in bug fixes in more recent changes to the submodules you\nwill have to update the references on your own. If source files are added or\nremoved in the submodules then the visual studio project will likely need\nadjusting. See the commit log for examples of submodule updates and associated\nvisual studio file changes to guide you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flvgl%2Flv_binding_pikascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flvgl%2Flv_binding_pikascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flvgl%2Flv_binding_pikascript/lists"}