This part response to Re^2: Query the height of Tk::Text widget with word wrap

Well, click once, resize window so there is wrapping, click again, compare the numbers

dlineinfo/bbox apparently mostly works for stuff that is visible , that isn't scrolled out of the view

Wow, that's written in a complicated way.

Sure its not :D subs are the fundamental units of code, the essence of good programming, they are testable, if used with argument passing they provide scoping, argument passing eliminates circular references and leaks with closures ... why is my-Tk-prog taking so much memory? It isn't, oh thank you mr non-circular-non-leaky:)

sub foo { my( $mw, $t ) ... } sub bar { my( $mw, $t ) ... } sub Main { GoTk(...); GoTk(...); } sub GoTk { ... [\&foo, $mw, $t] ... [\&bar, $mw, $t] ... MainLoop }

more on this tk closures people, Re: TK Submenus (Tk::Menu , global variables/ spirit of strict), tk scoping function argument passing, can't share Tk mainwondow between threads

This part response to Re^3: Query the height of Tk::Text widget with word wrap

I still can't get dlineinfo to work.

Remember how I (my program) had a button? Meaning you only (it only) call dlineinfo after MainLoop starts and draws everything on screen?

If the widgets (text ...) aren't drawn, dlineinfo can't return coordinates ... so if you want it to work in this program you need to draw the widget, you need $tw->update; before dlineinfo stuff

I used $tw->update; print "now its drawn, now it will be visible\n"; sleep 1;

The window can be located off-the-monitor while the initial drawing takes place :)  $mw->geometry('-1000-1000');


In reply to Re^4: Query the height of Tk::Text widget with word wrap by Anonymous Monk
in thread Query the height of Tk::Text widget with word wrap by elef

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.