peterhinch / micropython-micro-gui

A lightweight MicroPython GUI library for display drivers based on framebuf, allows input via pushbuttons. See also micropython-touch.
MIT License
237 stars 36 forks source link

Keypads and Keyboards #33

Open rs-bjorn opened 1 year ago

rs-bjorn commented 1 year ago

Good Day,

I am looking forward to using this library in an upcoming project. However, unfortunately it currently doesn't support keypads or keyboards. Is there a roadmap for implementing such support, or some tips on how to modify the library to include text fields? I am not sure what the best approach could be at this stage, but individual button inputs or accepting uart/i2c characters might be a way to implement this.

Types of keypads:

thank you.

peterhinch commented 1 year ago

I have no plans to implement this. User requirements are likely to be varied. Some would want to support navigation, with data entry in the current field. Alphanumeric support would involve backspace and delete. And so on.

It sounds like your requirement is for a single instance of a widget accepting numeric data. I think this could be done by subclassing the Label widget. The subclass would run a uasyncio task which accepts input from the keypad and alters the control's value. This could work with UART or buttons. I'm unsure about I2C: you'd need to check for blocking methods. I think UART would be easiest as you can use a StreamReader to acquire input.

An interesting project :)