jplattel / upymenu Goto Github PK
View Code? Open in Web Editor NEWMicropython Menu for LCD Displays
License: MIT License
Micropython Menu for LCD Displays
License: MIT License
Hello, I am using you library and is working great now (Thanks) but I have to make a few changes to make it work.
def _render_cursor(self):
for l in range(0, self.lines):
self.lcd.move_to(0, l)
and
def _render_options(self):
# Render the options:
for l, option in enumerate(self.viewport):
self.lcd.move_to(1, l) # Move to the line
2)When I have more than 8 options the view chunk retrun was off. With this code is working for me (also no need of import math anymore):
def _current_chunk(self):
return int((self.focus -1) / (self.lines )) # current chunk
def __init__(self, title, render_title=False):
self.current = self
def parent(self):
if self.parent_menu:
self.active = False
self.parent_menu.current = self.parent_menu
return self.parent_menu.start(self.lcd)
def _choose_menu(self, submenu):
self.active = False
self.current = submenu
thanks for sharing the library. Regards.
Good afternoon. I'm trying to implement a menu on the 2004 display. The code will be below. The problem is that when activated, the menu does not show the entire list of items on the screen, but only the last one. And also, instead of the cursor on the screen, the letters "SA". What could be the problem?
If the menu works fine, the next question is: how to fasten the execution of the interrupt function to it.
`called_back_main = False
called_back_sub = False
def action_callback_main():
global called_back_main
print ("Действие главного меню")
called_back_main = True
def action_callback_sub():
global called_back_sub
print ("Действие подменю")
called_back_sub = True
submenu = Menu("Submenu")
submenu_action_1 = MenuAction("Submenu Action", callback=action_callback_sub)
submenu_action_2 = MenuAction("Submenu Action 1", callback=action_callback_sub)
submenu.add_option(submenu_action_1)
submenu.add_option(submenu_action_2)
menu = Menu("Main menu")
menu_action_1 = MenuAction("Action_1", callback=action_callback_main)
menu_action_2 = MenuAction(" Action_2", callback=action_callback_main)
menu.add_option(submenu)
menu.add_option(menu_action_1)
menu.add_option(menu_action_2)
menu.add_option(MenuNoop(" Главное меню"))
current_menu = menu.start(lcd)`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.