#!/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 {calculate();}); #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 => \$txtbox_title); Tkx::grid(".c.txtbox_title", -column => 2, -row => 2, -sticky => "e"); Tkx::ttk__entry(".c.txtbox_author", -width => 25, -textvariable => \$txtbox_author); Tkx::grid(".c.txtbox_author", -column => 2, -row => 3, -sticky => "e"); Tkx::ttk__entry(".c.txtbox_series", -width => 25, -textvariable => \$txtbox_series); Tkx::grid(".c.txtbox_series", -column => 2, -row => 4, -sticky => "e"); Tkx::ttk__entry(".c.txtbox_isbn", -width => 25, -textvariable => \$txtbox_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_series $txtbox_isbn); $data = "$txtbox_file_name,$txtbox_title,$txtbox_author,$txtbox_series,$txtbox_isbn\n"; print $WRITEFILE "$data"; close $WRITEFILE; } # sub clear { # delete our $txtbox_file_name; # } Tkx::MainLoop();