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
247 stars 37 forks source link

Unable to suppress drawing of the border around the buttons #37

Closed felis closed 10 months ago

felis commented 10 months ago

Specifying bdcolor=False or bdcolor=BLACK in Button doesn't seem to work. The border around the button still appears. Similarly, the border around a Label won't appear when I specify bdcolor=True. Modified simple.py is here -> https://gist.github.com/felis/6ed1a85f4d7129b9ec67971e3215153b . The board is Lilygo TTGO T-Display V.1.1, the Micropython binary is ESP32_GENERIC-20231005-v1.21.0.bin . The navigation is encoder only.

I can post pictures if necessary.

Thank you, Oleg.

peterhinch commented 10 months ago

Hi Oleg, taking your second problem first - the Label - specifying bdcolor=True is invalid. Acceptable values are False, None or a color (see docs). As far as I can see Label is behaving correctly. [EDIT] Re Button. The border is drawn outside of the button itself and, as far as I can see, it is working correctly. The confusion is over the nature of the Button object. This is perhaps best illustrated with a circular button. The border is a rectangular object outside of the button. The button consists of a circle drawn in fgcolor with a background bgcolor. A rectangular button is similar and comprises a rectangle drawn in fgcolor infilled with bgcolor. To draw a red button with no border and no outline, you could use

Button(wri, row, col, text='No', bdcolor=False, fgcolor=BLACK, textcolor=YELLOW, bgcolor=RED, callback=my_callback, args=('No',))

Regards, Pete

peterhinch commented 10 months ago

Oleg - I hope this answers your queries. If not please reopen or open a new issue. Regards, Pete

felis commented 10 months ago

Pete,

Just checked - it works. Thank you very much!

Oleg.