in reply to Perl/Tk + CSSH

It dawned on me, that there is another option which you may be looking for.... the xid option. Some programs, will have the " into an xwindow id " option. It allows you to open a frame in Tk or Gtk2, then get its X window id, then specify that as an option to xterm. See embedding xterm into a Tk app for example.

Here is the simplest example possible. When doing this sort of thing, you may experience glitches in keyboard or mouse focus, but you likely will be lucky.

#!/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

Replies are listed 'Best First'.
Re^2: Perl/Tk + CSSH
by Monkless (Acolyte) on Feb 08, 2012 at 13:42 UTC

    You truly are a Monk among Monks.. :p Packing the geometry in the command was brilliant! I like the sound of the xid option, gonna play with both and will let you know what road I traveled! Thanks again for the knowledge BOMB!

      I resolved this by using a little perl foo..

      Instead of controlling the windows via Perl/TK - I opted to look into the window manager itself and what I found was..

      'wmctrl' is a window manager for Unix, once installed I was able to run wmctrl -l for a window listing - I then was able to manipulate where the windows were placed via wmctrl.

      (eg. `wmctrl -i -r '$e' -e 0,$x,$y,-1,-1`;)

      $e = window ID - $x,$y = X and Y window positioning found with xwininfo

      does use a system call, but much easier than trying to control a call outside of the app.