vr786 has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks , I wanted to set the terminal into my script , how can i set the terminal (xterm) into main-window.Can we display the two terminals in one window?.Please suggest me the way ......!

use strict; use warnings; use Tk; $mw=MainWindow->new; $mw->geometry("500x500"); MainLoop;

Replies are listed 'Best First'.
Re: How to get the terminal in perl tk
by zentara (Cardinal) on Dec 21, 2010 at 17:47 UTC
    See embedding xterm into a Tk app or look at this:
    #!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new( -bg => 'white' ); $mw->geometry('400x400' . '+100+100'); my $frame1 = $mw->Frame( -height => 30, -bg => 'lightblue', )->pack( -fill => 'x', -side => 'top' ); my $frame; my $button = $frame1->Button( -text => 'Open window', -command => sub { open_w($frame) }, )->pack; $frame = $mw->Frame( -container => 1, -bg => 'white', -relief => 'sunken', -bd => 2, )->pack( -fill => 'y', -side => 'left' ); MainLoop(); sub open_w { my ($f) = @_; my $id = sprintf hex $f->id; my $t = $mw->Toplevel( -use => $id ); system("xterm -into $id &"); }

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: How to get the terminal in perl tk
by SuicideJunkie (Vicar) on Dec 21, 2010 at 17:57 UTC

    Hmm... Perhaps you should state your definitions of "terminal", "window" and "in". Your usage of them does not make much sense.

    Also: What does that code segment have to do with the question? Code should not be posted just for the sake of posting code; it needs to be relevant.

      zentara posted code that does exactly what the OP requested: a way to embed an xterm within a Tk window, preferably the main window, and perhaps with the possibility of multiple simultaneous embedded instances.