I need to create a rectangle in a Canvas widget using the background color as the fill color. I don't care what color the background of the Canvas is, I just want to get the color. So the relevant bit of code would look like this:
myCanvas.create_rectangle(x0, y0, x1, y1, outline=myCanvas.bgcolor(),
fill=myCanvas.bgcolor())
Where naturally myCanvas.bgcolor()
is what I'm after.
I've seen lots of examples of setting this and other parameters, but none for getting.
You should be able to access the color through myCanvas["background"]
myCanvas.create_rectangle( x0, y0, x1, y1, outline=myCanvas["background"], fill=myCanvas["background"])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With