Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Tkx Issue

by jack64 (Initiate)
on May 07, 2013 at 17:09 UTC ( #1032515=perlquestion: print w/ replies, xml ) Need Help??
jack64 has asked for the wisdom of the Perl Monks concerning the following question:

Im using tkx to make a GUI to compute crc values.... The issue is i need to read the input from the textbox($input) and make some calculations and write it to a textbox($output)..but im not able to make it..pls guide me on this..thanks...

#use strict; use Tkx; use Digest::CRC;; my $mw = Tkx::widget->new('.'); my $asciicrc,$hexcrc; $mw->g_wm_minsize( 100, 200 ); # Command Buttons my $asciiconversion = $mw->new_ttk__button( -text => "ASCII Conversion +", -width => 20, -command => sub { ascii(); } ); Tkx::grid( $asciiconversion, -row => 1, -columnspan => 1, -padx => 5, +-pady => 5 ); my $hexconversion = $mw->new_ttk__button( -text => "HEX Conversion", - +width => 20, -command => sub { hexa(); } ); Tkx::grid( $hexconversion, -row => 2, -columnspan => 2, -padx => 0, -p +ady => 0 ); # Text Boxes my $input = $mw->new_tk__text( -width => 40, -height => 5, -state => " +normal", -wrap => "none" ); my $output = $mw->new_tk__text( -width => 40, -height => 5, -state => +"disabled", -wrap => "none" ); Tkx::grid( $input, -row => 3, -columnspan => 1, -padx => 10, -pady => +10 ); Tkx::grid( $output, -row => 4, -columnspan => 2, -padx => 10, -pady => + 10 ); Tkx::MainLoop(); sub ascii { $asciicrc = Digest::CRC->new( type => "crc32" ) ; $asciicrc->add($input); print $input; my $asciiout=$asciicrc->hexdigest(); print "The checksum of $input is $asciiout \n"; } sub hexa { $hexcrc = Digest::CRC->new(type=>"crc32");; my $hexout= $hexcrc->add( pack 'H*', $input)->hexdigest;; print "The checksum of $input is $hexout \n"; }

Comment on Tkx Issue
Download Code
Replies are listed 'Best First'.
Re: Tkx Issue
by Anonymous Monk on May 07, 2013 at 17:27 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2016-02-10 07:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (336 votes), past polls