Folks,

I am creating a small lite weight gui to enter data into a text file. This is more of a learning experience then anything. I currently have Perl/tk books on route; however, I am using the Tkx library in Activestate. I have found a number Tk examples to clear the content of a textbox; however, I really cannot find what I am looking for for Tkx - to be honest not sure what I need to look for.

I need some help with my clear sub

#!/usr/bin/perl use Tkx; Tkx::wm_title(".", "CSV Book Entry"); Tkx::ttk__frame(".c", -padding => "3 3 12 12"); Tkx::grid( ".c", -column => 0, -row => 0, -sticky => "nwes"); Tkx::grid_columnconfigure( ".", 0, -weight => 1); Tkx::grid_rowconfigure(".", 0, -weight => 1); #Tkx::ttk__entry(".c.feet", -width => 7, -textvariable => \$feet); #Tkx::grid(".c.feet", -column => 2, -row => 1, -sticky => "we"); #Tkx::ttk__label(".c.meters", -textvariable => \$meters); #Tkx::grid(".c.meters", -column => 2, -row => 2, -sticky => "we"); #Tkx::ttk__button(".c.calc", -text => "Calculate", -command => sub {ca +lculate();}); #Tkx::grid(".c.calc", -column => 3, -row => 3, -sticky => "w"); Tkx::ttk__entry(".c.txtbox_file_name", -width => 25, -textvariable => +\$txtbox_file_name); Tkx::grid(".c.txtbox_file_name", -column => 2, -row => 1, -sticky => " +e"); Tkx::ttk__entry(".c.txtbox_title", -width => 25, -textvariable => \$tx +tbox_title); Tkx::grid(".c.txtbox_title", -column => 2, -row => 2, -sticky => "e"); Tkx::ttk__entry(".c.txtbox_author", -width => 25, -textvariable => \$t +xtbox_author); Tkx::grid(".c.txtbox_author", -column => 2, -row => 3, -sticky => "e") +; Tkx::ttk__entry(".c.txtbox_series", -width => 25, -textvariable => \$t +xtbox_series); Tkx::grid(".c.txtbox_series", -column => 2, -row => 4, -sticky => "e") +; Tkx::ttk__entry(".c.txtbox_isbn", -width => 25, -textvariable => \$txt +box_isbn); Tkx::grid(".c.txtbox_isbn", -column => 2, -row => 5, -sticky => "e"); Tkx::ttk__button(".c.enter", -text => "Enter", -command => sub {enter( +);}); Tkx::grid(".c.enter", -column => 1, -row => 6, -sticky => "w"); Tkx::ttk__button(".c.clear", -text => "Clear", -command => sub {clear( +);}); Tkx::grid(".c.clear", -column => 2, -row => 6, -sticky => "we"); Tkx::grid( Tkx::ttk__label(".c.flbl", -text => "FILENAME:"), -column = +> 1, -row => 1, -sticky => "w"); Tkx::grid( Tkx::ttk__label(".c.islbl", -text => "TITLE:"), -column => +1, -row => 2, -sticky => "W"); Tkx::grid( Tkx::ttk__label(".c.mlbl", -text => "AUTHOR:"), -column => +1, -row => 3, -sticky => "w"); Tkx::grid( Tkx::ttk__label(".c.slbl", -text => "SERIES:"), -column => + 1, -row => 4, -sticky => "W"); Tkx::grid( Tkx::ttk__label(".c.isbnlbl", -text => "ISBN:"), -column => + 1, -row => 5, -sticky => "W"); sub enter { $filename = 'bookdb.txt'; open($WRITEFILE, '>>', $filename) or die; #Maybe add values into array??? #@data = qw($txtbox_file_name $txtbox_title $txtbox_author $txtbox_s +eries $txtbox_isbn); $data = "$txtbox_file_name,$txtbox_title,$txtbox_author,$txtbox_seri +es,$txtbox_isbn\n"; print $WRITEFILE "$data"; close $WRITEFILE; } # sub clear { # delete our $txtbox_file_name; # } Tkx::MainLoop();

Thank you much appreciated


In reply to Tkx and clear a textbox content by jasonwolf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.