{"id":13802649,"url":"https://github.com/jplattel/upymenu","last_synced_at":"2025-05-07T08:21:04.055Z","repository":{"id":50177892,"uuid":"235668050","full_name":"jplattel/upymenu","owner":"jplattel","description":"Micropython Menu for LCD Displays","archived":false,"fork":false,"pushed_at":"2022-12-08T03:29:20.000Z","size":25,"stargazers_count":31,"open_issues_count":6,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T14:58:47.203Z","etag":null,"topics":["esp32","lcd","lcd-display","lcd16x2","lcd20x4","menu","micropython","navigation","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/jplattel.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":"2020-01-22T21:13:35.000Z","updated_at":"2025-04-16T07:12:42.000Z","dependencies_parsed_at":"2023-01-25T04:15:19.245Z","dependency_job_id":null,"html_url":"https://github.com/jplattel/upymenu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplattel%2Fupymenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplattel%2Fupymenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplattel%2Fupymenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplattel%2Fupymenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jplattel","download_url":"https://codeload.github.com/jplattel/upymenu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252839674,"owners_count":21812148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["esp32","lcd","lcd-display","lcd16x2","lcd20x4","menu","micropython","navigation","python"],"created_at":"2024-08-04T00:01:49.410Z","updated_at":"2025-05-07T08:21:04.020Z","avatar_url":"https://github.com/jplattel.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["User Interface"],"readme":"# uPyMenu\n\nuPyMenu is a micropython menu implementation for LCD displays. Coming from an Arduino experience, I was used with [LiquidCrystal](https://github.com/arduino-libraries/LiquidCrystal) and [LiquidMenu](https://github.com/VaSe7u/LiquidMenu), but they don't offer a python implementation. So I figured I could create one myself.\n\n# Development\n\nCurrent development is done based on when I have to to work on it when I want to. But feel free to fork it and add your functionality. If you find any bugs or have suggestions for features, please open up a issue (or pull-request if you create the feature yourself!).\n\n## TODO\n\n*   Add arguments to callback actions in the menu\n\n# Usage\n\nThe example below renders a menu with a submenu and actions that have callbacks attached which you can use to run your own function. It requires one dependency, and that's [`python_lcd`](https://github.com/dhylands/python_lcd) for interacting with the LCD itself.\n\n```python\nfrom machine import Pin, I2C # Basics for creating an LCD interface\nfrom esp8266_i2c_lcd import I2cLcd # Example LCD interface used\nfrom upymenu import Menu, MenuAction, MenuNoop\n\ndef action_callback():\n    print(\"callback action chosen\")\n\nsubmenu = Menu(\"Submenu\")\nsubmenu_action_1 = MenuAction(\"Submenu Action\", callback=action_callback)\nsubmenu_action_2 = MenuAction(\"Submenu Action 1\", callback=action_callback)\nsubmenu.add_option(submenu_action_1)\nsubmenu.add_option(submenu_action_2)\n\nmenu_action = MenuAction(\"Action\", callback=action_callback)\nmenu = Menu(\"Main Menu\")\nmenu.add_option(submenu)\nmenu.add_option(menu_action)\nmenu.add_option(MenuNoop(\"Nothing here\"))\n\n# Example config for LCD via i2c, you will need this \n# for the menu to function, the screen size is required\n# to render the menu correctly on the screen.\ni2c = I2C(scl=Pin(5), sda=Pin(4), freq=400000)\nlcd = I2cLcd(i2c, 0x3F, 4, 20)\n\ncurrent_menu = menu.start(lcd) # Starts the menu on the LCD\n\nmenu.focus_next() # Focus on the next item in the menu \nmenu.focus_prev() # Focus on the previous item in the menu \n\n# Choose the focused item, if it's and action execute \n# the callback, or if it is a menu, render that menu.\nmenu = menu.choose()\n\n# If it's a submenu, you can use the parent() function\n# to navigate back up to the tree.\nmenu = menu.parent() \n```\n\n# Testing\n\nIf you have a `micropython` port running locally, you can run the test suite with it, ie: `micropython tests.py`. This is as close I can get with my current knowledge about micropython. Any pointers and suggestions towards improvement here would be appreciated!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjplattel%2Fupymenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjplattel%2Fupymenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjplattel%2Fupymenu/lists"}