in reply to Re^2: embedding xterm in perl/tk window
in thread embedding xterm in perl/tk window

Let's take a step back and talk about why you are using an xterm this way. What does the xterm process give you that a basic Tk::Text window does not? If you are simply trying to display the output of a unix shell command inside a Perl/Tk app, the usual way to do that is:
use strict; use Tk; my $mw = MainWindow->new; my $tx = $mw->Scrolled('Text', -height => 24, -width => 90)->pack(); my $data = `programname`; $tx->insert( '0.0', $data ); MainLoop;
(That worked pretty well for me when I put "ls" in place of "programname".)

Presumably there's more to your app than that, but you get the idea. If that's the sort of thing you're after, using an embedded xterm, while really cool, is more complicated than it needs to be. If you need something more, what would that be, exactly?

Replies are listed 'Best First'.
Re^4: embedding xterm in perl/tk window
by diamantis (Beadle) on Oct 08, 2007 at 04:09 UTC
    Actually I have a ROText for outputing formated (nicely colored, parsed etc) data from some programs that my perl/tk application calls.

    Some programs ask for feedback from the user in a complicated way that I do not dare to use open3 to handle it. So, I thought that I could embed a terminal (xterm/konsole) as an "advanced" mode.

    For now I just call xterm or konsole as an external window, but I would prefer a pretier solution.

      Some programs ask for feedback from the user in a complicated way

      Can you edit these programs? If you can, change them so that they accept all necessary user input as command line args, rather than asking for input from the user after they start.

      If you can't edit them, have you checked to make sure whether they support a "non-interactive" mode of operation?

      If they absolutely require manual user input after they start, is it the case that the user is able to know what inputs will be needed before running the program? (Or is it instead the case that the program has to show some output, and then ask for manual input that might vary depending on what was shown and what the user wants to do?)

      If the choice is between a "free-floating" xterm (launched by your perl/tk app) vs. one that is embedded in your Tk window, and the former is working while the latter is proving to be a difficult challenge, it sounds like something that isn't really broken, and so maybe shouldn't be fixed.

        Unfortunately I can't edit the programs (I cannot distribute the edited ones etc) plus they are not very user-friendly. They have interactive and non-interactive responses depending on what function they perform, how they are invoked (with what parameters, data etc).

        I am trying to make a user friendly interface, thats why I thought of embedding the terminal, to have a more integrated look.

        Anyway I'm going to let xterm float. Thanks for the help.