#: TITLE : LOG VIEW #: BY : Jason ################################################################################ use Tkx; Tkx::wm_title(".", "Log Viewer"); 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); #--- label for device Tkx::grid( Tkx::ttk__label(".c.devicelbl", -text => "DEVICE:"), -column => 1, -row => 1, -sticky => "e"); #--- text box entry field #--- and label that is associated with textbox entry field Tkx::ttk__entry(".c.device", -width => 14, -textvariable => \$device); Tkx::grid(".c.device", -column => 2, -row => 1, -sticky => "we"); #--- label for start time field Tkx::grid( Tkx::ttk__label(".c.stimelbl", -text => "START TIME:"), -column => 1, -row => 2, -sticky => "e"); #--- start time field #--- start time field position Tkx::ttk__entry(".c.stime", -width => 10, -textvariable => \$stime); Tkx::grid(".c.stime", -column => 2, -row => 2, -sticky => "we"); #--- label for end field Tkx::grid( Tkx::ttk__label(".c.etimelbl", -text => "END TIME:"), -column => 3, -row => 2, -sticky => "e"); #--- end time field #--- end time field position Tkx::ttk__entry(".c.etime", -width => 10, -textvariable => \$etime); Tkx::grid(".c.etime", -column => 4, -row => 2, -sticky => "we"); #--- label for search field Tkx::grid( Tkx::ttk__label(".c.searchlbl", -text => "VALUE:"), -column => 1, -row => 3, -sticky => "e"); #--- search field #--- search field location Tkx::ttk__entry(".c.search", -width => 50, -textvariable => \$value); Tkx::grid(".c.search", -column=> 2, -row => 3, -columnspan => 3, -sticky => "we"); #--- button Tkx::ttk__button(".c.run", -text => "RUN", -command => sub {sub_device();}); Tkx::grid(".c.run", -column => 1, -row => 5, -columnspan => 4, -sticky => "we"); # new Tkx::ttk__label(".c.calc", -textvariable => \$output_device); Tkx::grid(".c.calc", -column => 0, -row => 6, -columnspan => 12, -sticky => "nsew"); foreach (Tkx::SplitList(Tkx::winfo_children(".c"))) { Tkx::grid_configure($_, -padx => 5, -pady => 5); } # new #Tkx::focus(".c.device"); #Tkx::bind(".", "", sub {calculate();}); Tkx::MainLoop(); #=============================================================================== # SUBROUTINES #=============================================================================== #sub calculate { # $calc = $device; #} sub sub_device { # $output_device = $device; open FILE,") { if ($line =~ /\b$device\b/i) { $output_device = $line; } } } sub sub_stime { $output_stime = $stime; } sub sub_etime { $output_etime = $etime; } #### Tkx::ttk__label(".c.calc", -textvariable => \$output_device); Tkx::grid(".c.calc", -column => 0, -row => 6, -columnspan => 12, -sticky => "nsew"); #### #datafile.txt 192.168.13.1,items are locked 192.168.13.1, error 192.168.26.1, error this is an error output 192.168.26.1,items are output items are out put 192.168.26.3 error,100 lerror,101 45:ea:32:a1:b3:21 32:ae:12:15:15:00 AF:00:E3:43:32:AA, error data is invalid 32:ae:12:15:15:00