in reply to Re^7: Query the height of Tk::Text widget with word wrap
in thread Query the height of Tk::Text widget with word wrap

no taskbar icon ... (or some other things) .. see Tk::Wm  perl -MTk -e " tkinit()->overrideredirect(1); MainLoop; "

not sure where i learned it, probably from tk splashscreen or maybe reading Tk::Wm and trying everything :)

$mw->overrideredirect(1); $heightwin ->overrideredirect(1); ... $mw->overrideredirect(0); ## 1 #~ 2 3 4 2 3 4 $mw->deiconify; $mw->geometry('+0+0'); $mw->raise; $mw->state('zoomed'); MainLoop;

It's also pretty slow. It takes about 3 or 4 seconds for 500 rows. I'm thinking about how to speed it up but I'm not sure.

you can always throw up a splashscreen :) but ~3 seconds is reasonable for me, half of that is loading/perl/tk... the other half is the dlineinfo loop ..

If you were to startup spreadsheet program or browser its not significantly faster

You could use dline/bbox on first line, and then guesstimate the width/height for the rest of the lines, but that only probably shaves at most half of ~1.5 seconds (not really sure which part of the dline/matrix equation takes the time, not gonna timeit)

  • Comment on Re^8: Query the height of Tk::Text widget with word wrap (tk without no tray icon overrideredirect splashscreen state zoomed deiconify
  • Select or Download Code

Replies are listed 'Best First'.
Re^9: Query the height of Tk::Text widget with word wrap (tk without no tray icon overrideredirect splashscreen state zoomed deiconify
by elef (Friar) on Dec 03, 2013 at 11:09 UTC
    Thanks, I will play around with those things.
    To be clear, the 3-4 secs is the calculation/display itself.
    This table is refreshed every time the user runs a query (possibly hundreds of times in one session).
    Up until now, I drew the same table by directly inserting text into the TableMatrix widget and setting approximate row heights based on the number of characters in each cell. That took well under half a second for 500 rows. Here, I need to refresh a widget 500 times for the calculation and then draw 500 widgets for display, and this takes 3-4 sec. It's not intolerable as the first ones show up immediately, but it seems like it should be possible to do it quicker.

    Also, when I display a table that takes up the whole screen and then the next search produces only one hit (i.e. only one row needs to be displayed), the hits from the previous search remain there (not all of them, only the top ones that fit on the screen). The TableMatrix widget is correctly resized, but the Text widgets remain there anyway. I tried to update the $mw and the frame the table is in, but that doesn't help. I tried to delete the text from those widgets; the text disappears but the outline of the widget stays. I tried to destroy the widgets and that clears the screen, but it causes an error the next time I try to create a widget in the same cell. I have several columns, so each Text widget is created with
    my @tw; [...] $tw[$row][$col] = $mw->Text()