[issue27058] Tkinter's canvas' dashed lines have incorrect segment lengths

Kevin report at bugs.python.org
Thu May 19 11:12:58 EDT 2016


New submission from Kevin:

When creating a dashed line using `Canvas.create_line`. Minimal reproducing example:

    from Tkinter import *
    root = Tk()
    canvas = Canvas(root, width=100, height=30, bg="black")
    canvas.pack()
    canvas.create_line((0,10,100,10), dash=(20,), fill="red")
    canvas.create_line((0,20,100,20), dash=(20,20), fill="green")
    root.mainloop()

Expected result: each line segment should be 20 pixels wide, separated by gaps 20 pixels wide.

Actual result: each line segment is 18 pixels wide, separated by gaps 6 pixels wide. See attached file for screenshot.

Additional information: this problem appears to only occur on Windows. The Stack Overflow Python chat room attempted to replicate this issue, starting around here: http://chat.stackoverflow.com/transcript/message/30645798#30645798. Users of Windows 7, 8, and 10 were able to replicate the incorrect segmenting behavior. Users of Linux had correct segment lengths. (some Windows & 2.7 users also noticed that their green line was 3 pixel segments with 3 pixel gaps, but this seems to be an independent bug which was already fixed somewhere between 2.7.2 and 2.7.10.)

----------
components: Tkinter, Windows
files: output.PNG
messages: 265868
nosy: kms70847, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Tkinter's canvas' dashed lines have incorrect segment lengths
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file42901/output.PNG

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27058>
_______________________________________


More information about the Python-bugs-list mailing list