Showing posts with label perl-Tk. Show all posts
Showing posts with label perl-Tk. Show all posts

Tuesday, March 17, 2009

a simple gui for rdesktop

rdesktop is an open source command line client for Windows Terminal Services.
to install it in Fedora, as root: yum install rdesktop

RTKdesktop is a simple gui written in perl-Tk.
it need perl and perl-Tk. as root: yum install perl perl-Tk

here's the code:

#!/usr/bin/perl
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
use Tk;
use File::Basename;
use warnings;

my $window = MainWindow->new;
$window->minsize(qw(300 100));
$window->maxsize(qw(300 100));
$window->title("GRdesktop 1.0");
my $ent = $window -> Entry(-textvariable => \$servername, -width => 24, -borderwidth =>2, -relief => 'sunken') -> pack();
$window->Button(-text => "Connect", -width => 18, -command => \&connection )->pack;
$window->Button(-text => "Quit", -width => 18, -command => \&finito )->pack;

MainLoop;

sub connection {
$cmd = "/usr/bin/rdesktop $servername";
system $cmd;
}

sub finito{
exit;
}