Closed beyonlo closed 1 year ago
You seem to be re-inventing micro-gui which is designed for user input. I'm not sure how I can help with debugging such a large chunk of code. Have you considered just using micro-gui?
Hello @peterhinch
You seem to be re-inventing micro-gui which is designed for user input.
I'm sorry! I was thinking that is considered user input
is just when user want to configure something, I was thinking that the action to change of windows (next/previous/longpress) is not considered as user input
. So, the correct usage of nano-gui
is just when user have no buttons, right?
I'm not sure how I can help with debugging such a large chunk of code. Have you considered just using micro-gui?
I look in the micro-gui (https://github.com/peterhinch/micropython-micro-gui) but it do not have option to use only one button. How can I use micro-gui
using one button, doing one click for the next window, double click for previous window and long press to execute some function? My project has as requirement need to have just one button, so is impossible to have two or more buttons in this project.
From micro-gui:
Options for data input comprise:
Two pushbuttons: limited capabilities with some widgets unusable for input. Three pushbuttons with full capability. Five pushbuttons: full capability, less "modal" interface. A switch-based navigation joystick: another way to implement five buttons. Via two pushbuttons and a rotary encoder such as this one. An intuitive interface. On ESP32 physical buttons may be replaced with touchpads.
Thank you!
I wasn't trying to suggest that what you're doing is impossible, just that you're doing something new. micro-gui
does require at least three buttons or a single joystick-style switch.
Unfortunately I am busy with other things and can't take on the task of getting your code working. I'm sure it's possible, but it may be quite a difficult task. Good luck!
Hello @peterhinch
I wasn't trying to suggest that what you're doing is impossible, just that you're doing something new.
micro-gui
does require at least three buttons or a single joystick-style switch.
Understood. Maybe is a good idea to have in the future a feature on the micro-gui to support just one button (one click next, double click previous, and long press to enter/out to/from a menu)?
Unfortunately I am busy with other things and can't take on the task of getting your code working. I'm sure it's possible, but it may be quite a difficult task. Good luck!
No problem, it's okay! Could you please tell me what do you think is better to start a new project using only one button:
Thank you in advanced!
I do not intend to add any form of user input to nano-gui
. Its aim is to be extremely lightweight. A UI adds considerable complexity.
I think adapting micro-gui is probably easier as it embodies concepts like Screen
and Menu
objects and uses asynchronous coding. It already uses the Pushbutton
class. One approach might be to develop the screens in 3-button mode, then adapt the UI to re-purpose the long-press and double-click callbacks.
I do not intend to add any form of user input to
nano-gui
. Its aim is to be extremely lightweight. A UI adds considerable complexity.
I was talking about to add that feature in the micro-gui, not nano-gui. So micro-gui can be used by default (without need to adapt) with just one button. Maybe my needs can be needs of others people.
I think adapting micro-gui is probably easier as it embodies concepts like
Screen
andMenu
objects and uses asynchronous coding. It already uses thePushbutton
class. One approach might be to develop the screens in 3-button mode, then adapt the UI to re-purpose the long-press and double-click callbacks.
Nice, I will to learn about micro-gui and to try this option so :)
Thank you very much!
I've thought about this some more - here is how I would proceed.
Write prototype code for your application embodying the navigation mechanism as a minimum. I would start out with two or three pushbuttons so that you can use the un-modified library. Use Button
widgets for navigation as per demos such as screen_change.py
. This way you'll get experience with how navigation with the Button
control operates.
With two buttons the functions are Select
and Next
. Prev
is merely a convenience.
Once you're happy that you have workable navigation, the modification to micro-gui
is merely to take the Select
button and ensure its doubleclick callback activates the Next
callback. You might want the long callback mapped onto Prev
. You'll need the suppress
arg for the Pushbutton
physical button.
This navigation isn't quite as you originally specified but it enables a lot of the micro-gui
functionality.
I was talking about to add that feature in the micro-gui
The 3-button mode enables the entire functionality of micro-gui
to be accessed. This really isn't practical with a single button, so this mode would rule out a great many widgets (such as numeric entry, dropdown lists and suchlike). The subset would need to be documented. I think your requirement is rather specialised, so I don't intend to implement it. However if you produce a documented fork I'd be happy to link to it in the docs.
Closing this. Further discussion belongs in micro-gui
.
@peterhinch I've thought about this some more as well, and I decided to change the hardware to put more two buttons, so will have three buttons working with micro-gui in full capability: Prev
, Select
and Next
.
I never used micro-gui, but I think add more two buttons on hardware will be better decision because as you told me, micro-gui already is ready to works with menus, etc and I will have full capability of it.
Thank you very much for clarify many things to me and help me with this decision!
Hi, I get a example from your code and changes somethings (just for tests), but after running many hours I have this error:
Ps: I'm using only one button for the display, so the idea is press go to next window, double press back to previous window and long press enter to a new menu of windows
The code is this:
start.py:
display.py: