Reputation: 10497
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.
Upvotes: 8
Views: 13335
Reputation: 1348
You should be able to access the color through myCanvas["background"]
myCanvas.create_rectangle( x0, y0, x1, y1, outline=myCanvas["background"], fill=myCanvas["background"])
Upvotes: 11