| 1 |
# ---------------------------------------------------------------------- |
| 2 |
# DEMO: canvasprintdialog in [incr Widgets] |
| 3 |
# ---------------------------------------------------------------------- |
| 4 |
package require Iwidgets 4.0 |
| 5 |
|
| 6 |
option add *textBackground seashell |
| 7 |
|
| 8 |
# |
| 9 |
# Make a canvas for the main application: |
| 10 |
# |
| 11 |
canvas .c -width 200 -height 200 -background white |
| 12 |
pack .c |
| 13 |
|
| 14 |
.c create rectangle 30 30 150 150 -fill blue |
| 15 |
.c create oval 70 70 190 190 -fill red |
| 16 |
.c create polygon 60 50 110 180 10 180 -fill green |
| 17 |
.c create text 100 5 -anchor n -text "Example Drawing" |
| 18 |
|
| 19 |
button .print -text "Print..." -command { |
| 20 |
if {[.pcd activate]} { |
| 21 |
puts "use command \".pcd print\" to really print" |
| 22 |
} else { |
| 23 |
puts "aborted" |
| 24 |
} |
| 25 |
} |
| 26 |
pack .print |
| 27 |
|
| 28 |
iwidgets::canvasprintdialog .pcd -modality application \ |
| 29 |
-printcmd "lpr" -pagesize "A4" |
| 30 |
|
| 31 |
.pcd setcanvas .c |