[HJG] On Linux, it works correctly: the drawings left and right are drawn with dashed lines. On Windows, the dash-pattern is ignored when the width is 2 or more. ---- #!/bin/bash # the next line restarts using wish \ exec /usr/bin/wish "$0" "$@" #: WinDash.tcl - HaJo Gurt - 2005-07-13 #: Bug-Demo: On Windows, dash-patterns only work with width 1 #########1#########2#########3#########4#########5#########6#########7##### package require Tk grid [canvas .c -width 300 -height 325] # Dash-patterns: {2 4} {2 8} {6 4} {6 4 2 4} {6 4 2 4 2 4} .c create oval 25 25 125 125 -width 1 -dash {2 4} -fill grey60 .c create oval 175 25 275 125 -width 2 -dash . .c create line 20 150 130 150 -fill grey30 -width 1 -dash {6 4 2 4 2 4} .c create line 170 150 280 150 -width 2 -dash {6 4 2 4} for {set y 170} {$y<=180} {incr y} { # crude workaround for thick dashed line: .c create line 20 $y 280 $y -fill grey30 -width 1 -dash {2 4 6 4} ;# -dash .- } .c create rect 25 200 125 300 -fill grey70 -width 1 -dash {6 4} .c create rect 175 200 275 300 -width 2 -dash - ---- The tcl-help text says "all values in the dash list will be multiplied by the line width before display. This assures that "." will always be displayed as a dot and "-" always as a dash regardless of the line width." But on Windows, it looks like the dash-pattern is ignored when the width is 2 or more. ---- [bch] I am running into this same problem. I develop a map application on an X11 system (FreeBSD) and deploy it on Windows. As you say, the dashed lines are drawn as specified on a non-Windows platform, but Windows won't do it "right." Unfortunately, the end-users of my application won't be moving to a non-Windows platform, thus I'm stuck trying to figure out how to get around this problem. I did some quick perusing of the Tk code, and I will summarize what I found below. (Note that I'm not a Tcl/Tk developer which means I could be missing some nuances and details.) The Windows dash support can be found in the file tk/win/tkWinDraw.c [http://tktoolkit.cvs.sourceforge.net/tktoolkit/tk/win/tkWinDraw.c?revision=1.12.2.2&view=markup&pathrev=core-8-4-14]. The code of interest is in the SetUpGraphicsPort function starting on line 1182. I couldn't see any reason why this function would cause the problems we are seeing. Then I did some other searching and found this site [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pens_9wha.asp] (MSDN). It has this to say: "CreatePen returns a pen with the specified width bit with the PS_SOLID style if you specify a width greater than one for the following styles: PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT." This is corroborated a little more clearly at this site [http://www.functionx.com/visualc/gdi/pens.htm] where it says: "This means that, if you specify the style as PS_DASH, PS_DOT, PS_DASHDOT, or PS_DASHDOTDOT but set a width higher than 1, the line would be drawn as PS_SOLID." The bottom line appears to be this: This is a Windows-specific problem, and overcoming that using the current methodology is probably not an option. I suppose one could write their own line drawing routines, etc. (ouch) ---- [Category Example] | [Category GUI]