@jodur, any ideas on how to modify the automation to accept multiple buttons? I was about to create a new automation for each button I have but feel like there would be a way to template this, just cant work out how!
@djj and others who are intrested. I have created a Blueprint for this button.
see: -assistant.io/t/zha-xiaomi-mijia-round-wireless-switch-wxkg01lm-with-hold-lumi-sensor-switch/263075
The thing is that the dim/brighten automation was initially based on the Xiaomi integration which exposed the long-press and release functions but after reading your post I understood why it is not working with my config (I am using the buttons through the ZHA integration which obviously does not support the long-press event).
To create this use canvas.create_rectangle() and canvas.create_text() methods and give them both of them same tag, say "button". The tag will be used when using canvas.tag_bind("tag", "")(you can also simply pass "current" as tag, which is assigned to the currently selected item by tkinter, in which case you can remove button tag).
Someone knows how to create a round button or a Round Pic can do? So I want the button only responds when you on the rounds, and not only in the rectangle of the Pic's. Do not wonder about the spelling, it is only via Google translate! 'm German
ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area
That way you could get the gui colour say by testing a pixel at 1,1 in the client area, and you could have images with giffs with transparent bits, or icons so you wouldn't be limited to drawing the button in your script.
I have but one pic in the background, and there are the distinctive colors! So the background image is available in different colors-blue and the button will be colored red, can I somehow make it to the not just a color but is looking for an areas of color?
Martin has a good point. If you were to create .gifs with transparent backgrounds to use as buttons then the problem of the GUI background colour would vanish. At the moment I want to watch the football on the television - I will see if I can produce an example for you tomorrow.
Malkey's code works even if you have a picture over top. So what you need to do is get a .gif with a transparent background (I have attached one as an example) and place it over the top of the graphic. That way both the GUI background colour and the .gif button colour are irrelevant as you can see from the example. Looks like a pretty good solution to me:
The only other thing I have changed in the script is to reset the MouseCoordMode once we have finished with the relative mouse coords. If this is not done, there could be problems the next time a Mouse function is used - as I know from bitter experience!
The .gif has a transparent background, so it should appear as a round button on any background - it certainly does on my machine. If that is not what you mean, can you explain again what you mean by "get the picture transparent".
dd2b598166