Button Background Colour
-
Hi,
Quick one I hope.Is it possible to change the background colour of a button from within code, i.e. I want to make the colour dynamic so I can make it all black or white like a crossword. Or should I utilise the image to match my needs?
Thanks for your time.
Regards
Gary
-
button_name.background_color = 'lightgray'
-
Thanks for that, I did search the class library for something like this but couldn’t/can’t find it. Am I looking in the wring place?
-
@GaryGadget Note that
ui.Button
is a subclass ofui.View
, so thebackground_color
property is inherited from that.
-
@GaryGadget
Note that when begin to type, the marvelous automatic generation of available methods:
-
Don’t know how I missed that. Thanks for your help.
-
@omzI have a suggestion that in the documentation when something is a subclass it always says so and links to the parent. eg at here
"class ui.Button"
becomes
"class ui.Button (subclass of ui.View)"
I have often forgotten something is a subclass or not known