-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python Turtle is not filling alternate overlapping areas of a shape with same color #83573
Comments
Alternate overlapping areas of shape are not getting filled with same color. But instead its white. from turtle import *
color('black', 'yellow')
begin_fill()
circle(40)
circle(60)
circle(80)
end_fill() Generated image ubuntu@python3.7.4 Raised a stackoverflow question |
Your SO question is essentially a duplicate. As I answered there, the graphics systems of Unix and Windows, used by tk and hence tkinter, handle filling of self-intersecting polygons differently. On Windows, if one draws a line from the outside to a particular region without going through an intersection, each line crossing toggles 'fill', starting with 'off' in the outside. The rule seems to be reversed for overlapping items, such as circles. On Windows, all three circles are yellow, whereas on macOS, the 60 circle is white, even if drawn last! So, no bug. The best we can do is document 'filling' for turtle. Our tkinter doc does not include tk widgets, in particular Canvas, and we cannot edit external sources. What happens with multiple fill colors? Blended, or last wins? # 1 fill block
from turtle import *
color('black', 'yellow')
begin_fill()
circle(40)
color('black', 'red')
circle(60)
color('black', 'blue')
circle(80)
end_fill() On Windows, 3 circles drawn, then all filled with blue. The same is true if the circle order is reversed. # multiple fill blocks
from turtle import *
color('black', 'yellow')
begin_fill()
circle(40)
end_fill()
color('black', 'red')
begin_fill()
circle(60)
end_fill()
color('black', 'blue')
begin_fill()
circle(80)
end_fill() On Windows, each circle fills with its color after it is drawn. Same final result. It is different if drawing order is reversed. The rule seems to be: lines are drawn with the current line color; fill is done at the end of each fill block with the current (last) fill color. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: