BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

The docs for Tk canvas say

pattern may have any of the forms accepted by Tk_GetDash.

I cannot find any reference in the distribution that tells me what those forms are?

If anyone with an answer to that question could also tell me how they found that information, it might save me asking the next time around.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re: Where is Tk_GetDash documented?
by PerlBear (Hermit) on Nov 19, 2005 at 02:42 UTC
    Greetings Fellow Monk:
    This post regarding Tk_GetDash got me curious so I decided to do a little digging. First I went to CPAN and didn't find any direct reference so I decided to Google it and see what fell out. Some of the the references there too wre fairly thin. Here is one of URLs that have a little more to them:

    A Tk_GetDash 'ManPage ' on linbox.com

    All of the one's that were titled as a manpage pretty much had the same content.
    Hope this helps.
Re: Where is Tk_GetDash documented?
by rcseege (Pilgrim) on Nov 19, 2005 at 02:56 UTC
    I really hate to ask this, but did you miss the DASH PATTERNS section in the Canvas docs? I'll reproduce it here for speed:

    DASH PATTERNS

    Many items support the notion of an dash pattern for outlines.

    The first possible syntax is a list of integers. Each element represents the number of pixels of a line segment. Only the odd segments are drawn using the ``outline'' color. The other segments are drawn transparant.

    The second possible syntax is a character list containing only 5 possible characters [.,-_ ]. The space can be used to enlarge the space between other line elements, and can not occur as the first position in the string. Some examples:

    -dash . = -dash [2,4] -dash - = -dash [6,4] -dash -. = -dash [6,4,2,4] -dash -.. = -dash [6,4,2,4,2,4] -dash '. ' = -dash [2,8] -dash ',' = -dash [4,4]

    The main difference of this syntax with the previous is that it it shape-conserving. This means that 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.

    On systems where only a limited set of dash patterns, the dash pattern will be displayed as the most close dash pattern that is available. For example, on Windows only the first 4 of the above examples are available. The last 2 examples will be displayed identically as the first one.


    Updated: Whoops! I should have read PerlBear's link a bit more closely...
      I really hate to ask this ...

      Don't. It's a perfectly fair and reasonable question. Yes, I did miss that section before posting.

      Essentially, I wasn't looking for it because I didn't know it existed. The Canvas docs are sufficiently large that I tend to search for stuff (Arc, Oval, Line etc.) rather than scrolling through linearly.

      I was looking for wherever Tk_GetGash was documented, as directed by the section of the Canvas docs I was referencing. First I searched the Canvas doc and found half a dozen references, but they are all references to it. None with an explanation.

      Then I grepped the docs directories and found all the same ones in the Canvas doc, and one other that was also a reference to, not an explanation of either the information or where to find it.

      If all those references to Tk_GetDash were links or references to the "Dash Patterns" section, I wouldn't have had the problem :).


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Where is Tk_GetDash documented?
by PodMaster (Abbot) on Nov 19, 2005 at 14:21 UTC
    If anyone with an answer to that question could also tell me how they found that information, it might save me asking the next time around.
    Here's what I'd normally do:
    • search for Tk_GetDash in perldoc Tk::Canvas
    • search for Dash in perldoc Tk::Canvas
    • grep for Tk_GetDash in perl/site/lib/Tk
    • grep for Dash in Tk-804.027
    • search the mailing list archives ( usually via http://perltk.org, but it doesn't seem to have that feature anymore). The list will yield results that are barely documented anywhere.
    • google for it (will find http://www.tcl.tk/man/tcl8.4/TkLib/GetDash.htm).
    I mostly end up super searching perlmonks (usually with PodMaster/crazyinsomniac/Jouke/zentara as authors) for snippets :)

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.