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.
你应该能够通过myCanvas["background"]
访问颜色
myCanvas.create_rectangle( x0, y0, x1, y1, outline=myCanvas["background"], fill=myCanvas["background"])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.