python-elgato-streamdeck
python-elgato-streamdeck copied to clipboard
Add example using image icons
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.
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.
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.
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.
Please keep on adding examples since they provided ones dont work as expected. Scaling errors for example.