Updated 2013-01-22 00:37:12 by Zipguy

Zipguy (2013-01-21) - You can find out my email address by clicking on Zipguy.

It started from this

"I did look at the console eval which is cool! Thanks for that. Not quite sure if I fully understand that yet. If I wrote a command like this:
 console eval {winfo geometry .}

it would not display in the console. However if I typed it into the console, it would display in there: 483x177+79+28 or something like that. One of the things on my to do list is to increase the width of the console, which would be nice to be able to retrieve the answer of 483 wide pixels from the console, and add 100 pixels to it, then format it to $geospec and give the command:
  console eval {wm geometry $geospec}

but that command would say
 can't read "geospec": no such variable

"

which was on another page (namely console - work with the parent window). I tried writing a program which would attempt to retrieve the console's width (and more) from the console's window manager. I got this far.
        #  zipguy - routine added for puts with date %Y-%m-%d and time 
proc puts_log {message {nr no} {pt pt}} {
        if {$nr == "nr"} {
                puts -nonewline " $message"
        } elseif {$pt == "pt" } {
                set time [clock format [clock seconds] -format "%Y-%m-%d %I:%M:%S %p"]
                puts "$time  $message" 
        } else {
                puts ""
        }
};# END-PROC

 console show
 set geospec "Unset"
 puts_log "geospec is: $geospec"

# console eval [ after idle {return }]
 console eval [ set a [list wm geometry .]]
# console eval {[consoleinterp [list set $geospec {$a}]]}
 puts_log "geospec is: $geospec"

Some of the lines I've been trying to get to work (with "console eval {}") are incorrect and don't seem to work. What I tried doing was making a list out of [wm geometry .] which did not seem to be accepted either. However, they do seem to work when they are typed into the console.

I don't know what I'm doing wrong, I must be dumb. Thanks for any help, that anyone, can provide to me.

RLE (2012-01-21): You really should read up on the interp documentation. console in your case is the name of a second interpreter and the console eval call asks that second interpreter to run a bit of code. The return value from console eval is whatever that bit of code returns. So if you change your example to be this it should work:
set geospec [ console eval {wm geometry .} ]

Then the current interpreter (where you are running set and console eval will receive the result from the wm geometry . being run in the second interpreter. Then you should be able to edit the geometry string, and pass it back to the second interpreter like so:
console eval [ list wm geometry . $geospec ]

At which point, assuming changing the console's geometry works properly, the console should change size.

Zipguy (2013-01-21) - Ahh... That works great. Thanks RLE. I tried all the wrong things, and not the right one, which seems extremely obvious, now that I've seen it. It is a little maddening to read most of the help files, and advance to the wrong approach. But I was reading the wrong part of the help files, on wm, and not on console.