|
Canvasprintbox
The Canvasprintbox iwidget allows the user to print from a canvas to a printer or file. The output is in postscript format. The user can choose from several different options, such as page orientation, number of pages to print, paper size, and also if the image should be stretched to fit the page. By using the setcanvas public method, the canvas is displayed as a thumbnail in the widget. This thumbnail is automatically updated when the options are changed (except for -stretch). There are several options so that the user can customize the default values when creating the canvasprintbox.
For further information, see the Canvasprintbox
manpage
Components: canvas canvasframe fileef filerb hpcnt hull orientom outputom pages paperom postercb printeref printerrb propsframe stretchcb vpcnt
|
wm title . "Canvasprintbox Example"
##=========================================================
## Create a canvasprintbox iwidget
##=========================================================
##
iwidgets::canvasprintbox .cpb \
-stretch 0 \
-filename "canvas_out.ps" \
-orient portrait \
-output file \
-pagesize Letter
pack .cpb
##
## Create a canvas to show the usage
##
canvas .can
pack .can \
-expand true \
-fill both
.can create oval 50 50 100 100 \
-fill red
.can create oval 100 50 150 100 \
-fill green
update
##
## import the canvas to the Canvasprintbox
##
.cpb setcanvas .can
pack forget .can
##
## Create a label to show the destination
## just for illustration purposes
##
label .label \
-relief raised
pack .label \
-fill x \
-expand true
.label configure \
-text "The output will go to: [.cpb getoutput]"
|
Download this sample code |
|