[clue-tech] WYSIWYG for Qt or Tk and PERL

dperkins at frii.com dperkins at frii.com
Fri Mar 24 07:41:15 MST 2006


You can try this.  I don't know Perl/Tk, so you might need to look up Frame.
I don't know what ROText is, but the positioning looks peculiar.  Hope
this helps.



my $inpFrame = $topWindow->Frame()
my $inpLabel = $inpFrame -> Label( -text => 'Enter Ip Address to query' )
    -> pack('side' -> 'left');
my $inpQueryHost = $inpFrame -> Entry(-width =>16, -background=>'white',
   -textvariable=>\$inputText, takefocus=>1) -> pack('side' -> 'left');
$inpFrame->pack();

# Build the buttons
my $btnFrame = $topWindow->Frame()
#my $b = $btnFrame -> Button( -text => 'Query Hosts', -command => &text
 );
my $butQueryHost = $btnFrame -> Button( -text => 'Query Hosts') ->
    pack('side' -> 'left');
my $butResetHost = $btnFrame -> Button( -text => 'Clear Form', -command
   => sub{ $inputText=""; }) -> pack('side' -> 'left');
$btnFrame->pack();

# Results/Text field
 my $resultText = $topWindow-> ROText (-width=>120, -height=>10,
 -background=>'white') -> pack();



> Bamm Visscher said:
>> Sounds like you need to use frames and maybe padding. Do you still
>> have an example of your code lying around?
>>
>
> I haven't looked at frames - I'll check it out. Here's a examle of the
> goofiness:
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> #!/usr/bin/perl
>
> #use strict;
> use Tk;
>
>
> # Build the GUI
> my $topWindow = new MainWindow;
>
> $topWindow->configure(-title=>"Admin Console");
>
> #my $lab = $topWindow -> Label( -textvariable => \$labelText );
> my $inpLabel = $topWindow -> Label( -text => 'Enter Ip Address to query' )
> -> pack();
>
> my $inpQueryHost = $topWindow -> Entry(-width =>16, -background=>'white',
> -textvariable=>\$inputText, takefocus=>1) -> pack();
>
> # Build the buttons
> #my $b = $topWindow -> Button( -text => 'Query Hosts', -command => &text
> );
> my $butQueryHost = $topWindow -> Button( -text => 'Query Hosts') ->
> pack();
> my $butResetHost = $topWindow -> Button( -text => 'Clear Form', -command
> => sub{ $inputText=""; }) -> pack();
>
> # Results/Text field
> my $resultText = $topWindow-> ROText (-width=>120, -height=>10,
> -background=>'white') -> pack();
>
> ## Place the widgets
> #$inpLabel	-> grid(-row=>0, -col=>0);
> #$inpQueryHost	-> grid(-row=>0, -col=>1);
> #$butQueryHost	-> grid(-row=>1, -col=>0);
> #$butResetHost	-> grid(-row=>1, -col=>1);
> #$resultText	-> grid(-row=>0, -col=>2);
>
> # make an action out of the button
> $butQueryHost->bind("<ButtonPress>", [\&get_hosts]);
>
>
> MainLoop;
>
>
> sub get_hosts {
> # do something
> }
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>
>
> Jeff
>
> _______________________________________________
> CLUE-tech mailing list
> CLUE-tech at cluedenver.org
> http://cluedenver.org/mailman/listinfo/clue-tech
>


_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list