Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

How to get the terminal in perl tk

by vr786 (Sexton)
on Dec 21, 2010 at 13:08 UTC ( [id://878247]=perlquestion: print w/replies, xml ) Need Help??

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 (Archbishop) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://878247]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-03-29 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found