Attention: The Usenet Article Lookup site has been updated.
The code for this site has been ported from Perl to PHP, so you could say, it is in beta mode. Please contact me if find any problems, or have any suggestions. -- Howard
Deutsch   English   Français   Italiano  

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!!!!!!!xmission!nnrp.xmission!not-for-mail
From: George Peter Staplin <>
Newsgroups: comp.lang.tcl
Subject: Re: embed vi editor in tk application
Date: Tue, 3 Jun 2008 19:49:05 +0000 (UTC)
Organization: nil
Lines: 67
Message-ID: <g2477h$lpb$>
References: <> <L3g1k.2523$> <>
X-Trace: 1212522545 22315 (3 Jun 2008 19:49:05 GMT)
NNTP-Posting-Date: Tue, 3 Jun 2008 19:49:05 +0000 (UTC)
User-Agent: slrn/ (Debian)
Bytes: 3071

Uwe Klein wrote:
> Bryan Oakley wrote:
>> wrote:
>>> How can embed the vi editor in tk application?
>>> Any tk widget available for this?
>>> Currently i am using scrolledtext widget to show and edit the file.
>>> I am used to with vi and want to embed the same in this application.
>>> Can somebody please help me out.
>>> thanks
>>> Amit M Joshi
>> The problem is, vi expects a terminal with curses support and Tk has no 
> ...........................
>> the text widget.
> OK, try this:
> # create a frame configure to embed another app
> frame .f -container true
> pack .f -expand 1 -fill both
> # expr used to a dezimal window ID
> # as winfo returns a string with the hexnumber
> set wID [ expr [ winfo id .f ] ]
> # the content you want to work on
> set file /etc/hosts
> # exec xterm with the "-into" option and have
> # it run vi with your file in background:
> exec xterm -into $wID -e vi $file &
> # exercise left: how to notice vi has ended.
> uwe

As the author of the -into patch to xterm (years ago), I think I should 
point out that the example isn't ideal, because it won't resize with the 
parent.  However it's possible to make it do so by selecting the 
SubstructureRedirectMask so that everytime the xterm resizes, you get a 
ConfigureRequest.  That's originally how I used xterm as a widget.

The original project I wrote that used the embedded xterm is no longer 
maintained.  I do however have some more recent code that demonstrates 
the sequence with ntk in a prototype:

Note: I decided I may need the ability to render offscreen with the 
XComposite, and XDamage extensions (at the least), so that it would work 
with NexTk and overlapped windows.

I'm willing to write an xterm widget that embeds xterm as a Tk widget, 
but I don't always have a lot of time and/or motivation.   I'll see if I 
can piece some code together this week though. 

The Whim desktop could use a Whimterm or something like that.