Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!perl -w use strict; use Tk; use Tk::Dialog; use PDF::Create; use PDF::Labels; my %Address_List; my $cntr=0; my $VERSION='0.01'; my $Main=new MainWindow; my $MenuFrame=$Main->Frame(-relief=>'flat',-borderwidth=>2); $MenuFrame->grid; $MenuFrame->Menubutton(-text=>'File',-menuitems=>[['command'=>'Exit',- +command=>\&Exit]])->pack(-side=>'left'); $MenuFrame->Menubutton(-text=>'Help',-menuitems=>[['command'=>'About', +-command=>\&About]])->pack(-side=>'right'); my $lblpos=$Main->Label(-text=>'Default Label Position:'); my $pos=$Main->Entry(-width=>2); $lblpos->grid($pos,-sticky=>'w'); $pos->focus; my $un=$Main->Label(-text=>'Name:'); my $name=$Main->Entry(-width=>40); $un->grid($name); my $Addr=$Main->Label(-text=>'Street:'); my $str=$Main->Entry(-width=>40); $Addr->grid($str); my $CSZ=$Main->Label(-text=>'City, State Zip-Code'); my $csz=$Main->Entry(-width=>40); $CSZ->grid($csz); my $AddBtn=$Main->Button(-text=>'Add',-command=>sub{Add_List($name,$st +r,$csz)}); my $CrtBtn=$Main->Button(-text=>'Create PDF',-command=>sub{Create_PDF( +$pos)}); my $ExtBtn=$Main->Button(-text=>'Exit',-command=>sub{ Exit()}); $AddBtn->grid($CrtBtn,$ExtBtn); MainLoop; sub Add_List{ my($Name,$Str,$Csz)=@_; my $N=$Name->get; my $S=$Str->get; my $C=$Csz->get; $cntr++; $Address_List{$cntr}=[$N,$S,$C]; &Clear; } sub Create_PDF{ my $position=shift; my $p=$position->get; if($p eq ""){ $p = 0; } my $pdf = new PDF::Labels( $PDF::Labels::PageFormats[0], filename=>'Labels.pdf', Author=>'PDF_Label_Maker', Title=>'Labels' ); $pdf->setlabel($p); foreach my $key(keys %Address_List){ $pdf->label("$Address_List{$key}[0]", "$Address_List{$key}[1]", "$Address_List{$key}[2]"); } $pdf->close(); &Done; } sub Clear{ $pos->delete(0,'end'); $name->delete(0,'end'); $str->delete(0,'end'); $csz->delete(0,'end'); $pos->focus; } sub About{ my $about=$Main->Dialog(-title=>'About PDF Label Maker',-text=>"PDF +Label Maker Version $VERSION\n Written by Thomas Stanley",-default_b +utton=>'Ok'); $about->Show; } sub Exit{ exit 0; } sub Done{ my $Done=$Main->Dialog(-title=>'File Created',-text=>"Labels.pdf was + created",-default_button=>'Ok'); $Done->Show; }

In reply to PDFLM by TStanley

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found