Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Perl Tk, how to get File Browser, capture output to a Log file and format my checkboxes

by tybalt89 (Monsignor)
on Mar 22, 2022 at 23:05 UTC ( [id://11142294]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl Tk, how to get File Browser, capture output to a Log file and format my checkboxes
in thread Perl Tk, how to get File Browser, capture output to a Log file and format my checkboxes

Replace

s/.{20}\K /\n/gr

with

s/(.{20}) /$1\n/gr

if you are running with an old perl.

  • Comment on Re^2: Perl Tk, how to get File Browser, capture output to a Log file and format my checkboxes
  • Select or Download Code

Replies are listed 'Best First'.
Re^3: Perl Tk, how to get File Browser, capture output to a Log file and format my checkboxes
by perlynewby (Scribe) on Mar 23, 2022 at 09:52 UTC

    Hello

    Yes, I am using and old perl version; it's the only one available to me. This is current perl -v, "This is perl, v5.6.1 built for i686-linux-thread-multi"

    So this perl version did not like the replacement s/(.{20}) /$1\n/gr , any other idea to satisfy this wrap around text ?

    I really would like to see your wrap around text code work.

    I was super busy at work today and feeling under the weather but I will post some updates to the GUI.

    Right now, only thing I can see having an issue is capturing the selection into a log file

    And adding a email utility with output of the selections.

    This is what I think the GUI to look

    A= Left side frame with ( about 4) long texts with a corresponding checkbox.

    B= 2 files chosen by using a file browser to select certain bank monthly statements.

    C= Lower frame is a "Special Note" selection that opens up for user input.

    D= Email button which sents an automated email with output of GUI to, say, daughter.

    diagram isn't working out; I tried. Sorry.

    xxxxxxxxxxxxx

    x A \t\t x \t\t B x

    xxxxxxxxxxxxxx

    x \t\t C \t\t x

    xxxxxxxxxxxxx

    x \t\t D \t\t x

    xxxxxxxxxxxxx

    Thanks for the help on formatting the checkboxes, adding the note pad too, and adding an extra checkbox

      --- pm11142273.pl.~54~ 2022-03-22 13:34:52.301454754 -0700 +++ pm11142273.pl 2022-03-23 06:39:44.750787662 -0700 @@ -5,7 +5,8 @@ use Tk; my $additionalcheckbutton = 0; -my @checkbuttonlabels = split /\n/, <<END; +# NOTE 1a) wrap if text too long +s/(.{20}) /$1\n/g for my @checkbuttonlabels = split /\n/, <<END; one two very long text entry for test purposes @@ -28,7 +29,7 @@ my @cbs = map { $leftframe->Checkbutton( - -text => s/.{20}\K /\n/gr, # NOTE 1a) wrap if text too + long + -text => $_, -anchor => 'w', # NOTE 1) align buttons with -fil +l x -variable => \$values[$n++], -command => \&addextra,
      > This is perl, v5.6.1

      Oh my God, according to perlhist, 5.6.1 is from 2001! It's more than 20 years old!

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      So this perl version did not like the replacement s/(.{20}) /$1\n/gr

      Indeed not. 5.6.1 is far too old for the /r modifier. Pre-copy instead. eg:

      #!/usr/bin/env perl use strict; use warnings; my $in = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed + do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut en +im ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. Duis aute irure dolor in reprehende +rit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. E +xcepteur sint occaecat cupidatat non proident, sunt in culpa qui offi +cia deserunt mollit anim id est laborum.'; (my $out = $in) =~ s/(.{20}) /$1\n/g; print "In:\n$in\n\nOUT:\n$out\n";

      🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142294]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 09:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found