python-elgato-streamdeck icon indicating copy to clipboard operation
python-elgato-streamdeck copied to clipboard

Add example using image icons

Open Kagee opened this issue 6 years ago • 4 comments

IT was quite a lot of work finding out how to properly convert images to the correct image format. I suggest adding this example that supports using button images from files.

Kagee avatar Nov 20 '18 21:11 Kagee

Thanks for the patch!

This is a good idea - there's code to generate custom tiles in my related HomeAssistant client project (see https://github.com/abcminiuser/python-homeassistant-streamdeck/blob/master/src/Tile/TileImage.py) although I can see it's also needed here for convenience' sake.

I've updated the example in 642bca0b6b1579aa4b80f5a211c18adedc3e333c to use only PIL to load custom fonts and images to generate custom tiles. I think this is about as minimal as you can get without introducing too many extra dependencies. If you think the example with svglib is warranted, let me know.

abcminiuser avatar Nov 21 '18 09:11 abcminiuser

I would actually suggest three functions in the example, color, custom tiles, and a simple function for using different images directly. Possibly just as three functions with a simmilar signature. That should cover most use cases.

Kagee avatar Nov 21 '18 11:11 Kagee

I feel a mixed presentation image (color, icon, icon + label) is also a good idea. Looking quickly at the image now, it may appear that the library can only create buttons with a small icon and text below. The visual presentation that a pressed button can hav another image is however also important.

Kagee avatar Nov 21 '18 12:11 Kagee

Please keep on adding examples since they provided ones dont work as expected. Scaling errors for example.

ChutiReality avatar Feb 26 '23 21:02 ChutiReality