Skip to content
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

Closed
lijose mannequin opened this issue Jan 20, 2020 · 5 comments
Closed

Python Turtle is not filling alternate overlapping areas of a shape with same color #83573

lijose mannequin opened this issue Jan 20, 2020 · 5 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes docs Documentation in the Doc dir

Comments

@lijose
Copy link
Mannequin

lijose mannequin commented Jan 20, 2020

BPO 39392
Nosy @terryjreedy, @willingc, @miss-islington, @lijose
PRs
  • bpo-39392: Turtle overlap fill depends on OS #18223
  • [3.8] bpo-39392: Turtle overlap fill depends on OS (GH-18223) #18224
  • [3.7] bpo-39392: Turtle overlap fill depends on OS (GH-18223) #18225
  • 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:

    assignee = None
    closed_at = <Date 2020-01-27.23:48:05.704>
    created_at = <Date 2020-01-20.05:14:23.723>
    labels = ['3.7', '3.8', '3.9', 'docs']
    title = 'Python Turtle is not filling alternate overlapping areas of a shape with same color'
    updated_at = <Date 2020-01-27.23:48:05.703>
    user = 'https://github.com/lijose'

    bugs.python.org fields:

    activity = <Date 2020-01-27.23:48:05.703>
    actor = 'terry.reedy'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2020-01-27.23:48:05.704>
    closer = 'terry.reedy'
    components = ['Documentation']
    creation = <Date 2020-01-20.05:14:23.723>
    creator = 'lijose'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39392
    keywords = ['patch']
    message_count = 5.0
    messages = ['360290', '360660', '360823', '360824', '360826']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'gregorlingl', 'docs@python', 'willingc', 'miss-islington', 'lijose']
    pr_nums = ['18223', '18224', '18225']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue39392'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @lijose
    Copy link
    Mannequin Author

    lijose mannequin commented Jan 20, 2020

    Alternate overlapping areas of shape are not getting filled with same color. But instead its white.
    Reproducible code

    from turtle import *
    color('black', 'yellow')    
    begin_fill()
    circle(40)
    circle(60)
    circle(80)
    end_fill()

    Generated image ubuntu@python3.7.4
    https://ibb.co/jG0bCBz

    Raised a stackoverflow question
    https://stackoverflow.com/questions/59811915/python-turtle-is-not-filling-alternate-overlapping-areas-of-a-shape-with-same-co

    @lijose lijose mannequin added type-bug An unexpected behavior, bug, or error topic-tkinter 3.7 (EOL) end of life labels Jan 20, 2020
    @terryjreedy
    Copy link
    Member

    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.

    @terryjreedy terryjreedy added docs Documentation in the Doc dir 3.8 only security fixes 3.9 only security fixes and removed topic-tkinter labels Jan 24, 2020
    @terryjreedy terryjreedy added docs Documentation in the Doc dir 3.8 only security fixes 3.9 only security fixes and removed type-bug An unexpected behavior, bug, or error topic-tkinter labels Jan 24, 2020
    @terryjreedy terryjreedy removed the type-bug An unexpected behavior, bug, or error label Jan 24, 2020
    @terryjreedy
    Copy link
    Member

    New changeset 2824c45 by Terry Jan Reedy in branch 'master':
    bpo-39392: Turtle overlap fill depends on OS (bpo-18223)
    2824c45

    @miss-islington
    Copy link
    Contributor

    New changeset 005b059 by Miss Islington (bot) in branch '3.7':
    bpo-39392: Turtle overlap fill depends on OS (GH-18223)
    005b059

    @miss-islington
    Copy link
    Contributor

    New changeset b487a8e by Miss Islington (bot) in branch '3.8':
    bpo-39392: Turtle overlap fill depends on OS (GH-18223)
    b487a8e

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes docs Documentation in the Doc dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants