| 1 | # ############################################################################## | ||
| 2 | # # Script : Canvasprintbox.pl # | ||
| 3 | # # -------------------------------------------------------------------------- # | ||
| 4 | # # Copyright : This program is free software; you can redistribute it and/or # | ||
| 5 | # # modify it under the same terms as Perl itself. # | ||
| 6 | # # Author : Jürgen von Brietzke JvBSoft # | ||
| 7 | # # Version : 1.2.01 16.Jun.2013 # | ||
| 8 | # ############################################################################## | ||
| 9 | # # http://incrtcl.sourceforge.net/iwidgets/iwidgets/canvasprintbox.html # | ||
| 10 | # ############################################################################## | ||
| 11 | |||
| 12 | use strict; | ||
| 13 | use warnings; | ||
| 14 | |||
| 15 | use Tkx::TclTk::Bind::IWidgets; | ||
| 16 | |||
| 17 | # ############################################################################## | ||
| 18 | |||
| 19 | my $main_window = Tkx::widget->new(q{.}); | ||
| 20 | $main_window->Tkx::wm_title('Canvasprintbox Example'); | ||
| 21 | my $canvasprintbox = $main_window->new_iwidgets__canvasprintbox( | ||
| 22 | -stretch => 0, | ||
| 23 | -filename => 'canvas_out.ps', | ||
| 24 | -orient => 'portrait', | ||
| 25 | -output => 'file', | ||
| 26 | -pagesize => 'Letter', | ||
| 27 | ); | ||
| 28 | Tkx::pack($canvasprintbox); | ||
| 29 | my $canvas = $main_window->new_tk__canvas(); | ||
| 30 | Tkx::pack( $canvas, -expand => 'true', -fill => 'both' ); | ||
| 31 | $canvas->create( 'oval', 50, 50, 100, 100, -fill => 'red' ); | ||
| 32 | $canvas->create( 'oval', 100, 50, 150, 100, -fill => 'green' ); | ||
| 33 | $canvasprintbox->setcanvas($canvas); | ||
| 34 | Tkx::pack( forget => $canvas ); | ||
| 35 | my $label = $main_window->new_ttk__label( -relief => 'raised' ); | ||
| 36 | Tkx::pack( $label, -fill => 'x', -expand => 'true' ), | ||
| 37 | $label->configure( | ||
| 38 | -text => 'The output will go to: ' . $canvasprintbox->getoutput ); | ||
| 39 | |||
| 40 | Tkx::MainLoop(); | ||
| 41 | |||
| 42 | # ############################################################################## | ||
| 43 | # # E N D # | ||
| 44 | # ############################################################################## |