Terry J. Reedy <[email protected]> added the comment:
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.
----------
assignee: -> docs@python
components: +Documentation -Tkinter
nosy: +docs@python, terry.reedy
stage: -> needs patch
type: behavior ->
versions: +Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39392>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com