From: Arman Ohanian on
Hi All,

I am using a code found on the Wiki to implement a "console" in Unix for my
program. I am using the following code: http://wiki.tcl.tk/786

Here is my problem. I want to embed that console into my main GUI.
The console is created in a slave interpreter. There is a window
path .console in the slave.
However, .console doesn't exist in the main interpreter, so I can't pack or
place it.

How can I handle this?

Also, I will probably face a similar problem in windows since I am using the
built-in 'console' there.

Please advice.
Any ideas are appreciated.

Thanks,
-Arman.


From: Neil Madden on
Arman Ohanian wrote:
> Hi All,
>
> I am using a code found on the Wiki to implement a "console" in Unix for my
> program. I am using the following code: http://wiki.tcl.tk/786
>
> Here is my problem. I want to embed that console into my main GUI.
> The console is created in a slave interpreter. There is a window
> path .console in the slave.
> However, .console doesn't exist in the main interpreter, so I can't pack or
> place it.
>
> How can I handle this?
>
> Also, I will probably face a similar problem in windows since I am using the
> built-in 'console' there.
>
> Please advice.
> Any ideas are appreciated.

When loading Tk into a slave interpreter you can specify a container
frame to become the "." window in that slave. To do this you need to set
up a fake ::argv variable with the -use option in it:

set i [interp create]
set f [frame .f -container 1]
$i eval [list set ::argv [list -use [winfo id $f]]]
$i eval { load {} Tk }
$i eval {
button .b -text Hello! -command {puts "Hello from slave!"}
pack .b
}
pack $f -fill both -expand 1

See also the safe::loadTk command that does this for a safe slave.

-- Neil
From: Pat Thoyts on
Arman Ohanian <aohanian(a)sbcglobal.net> writes:

>Hi All,
>
>I am using a code found on the Wiki to implement a "console" in Unix for my
>program. I am using the following code: http://wiki.tcl.tk/786
>
>Here is my problem. I want to embed that console into my main GUI.
>The console is created in a slave interpreter. There is a window
>path .console in the slave.
>However, .console doesn't exist in the main interpreter, so I can't pack or
>place it.
>
>How can I handle this?
>
>Also, I will probably face a similar problem in windows since I am using the
>built-in 'console' there.
>

The tkchat application has an example that can do this. See the
::tkchat::EmbeddedConsoleDemo funtion at the end of the
tkchat_console.tcl file

http://tcllib.cvs.sourceforge.net/*checkout*/tcllib/tclapps/apps/tkchat/tkchat_console.tcl?revision=1.2&content-type=text%2Fplain



--
Pat Thoyts http://www.patthoyts.tk/
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
 | 
Pages: 1
Prev: Inverse of Tk canvasx ?
Next: java vs tcl