summaryrefslogtreecommitdiffstats
path: root/library/print.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/print.tcl')
-rw-r--r--library/print.tcl10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/print.tcl b/library/print.tcl
index 1a049e2..bea590a 100644
--- a/library/print.tcl
+++ b/library/print.tcl
@@ -740,6 +740,11 @@ namespace eval ::tk::print {
proc ::tk::print::canvas {w} {
+ if {[winfo class $w] ne "Canvas"} {
+ error "Tk only supports printing from canvas and text widgets."
+ return
+ }
+
if {[tk windowingsystem] eq "win32"} {
::tk::print::_print_widget $w 0 "Tk Print Output"
}
@@ -748,6 +753,11 @@ proc ::tk::print::canvas {w} {
proc ::tk::print::text {w} {
+ if {[winfo class $w] ne "Text"} {
+ error "Tk only supports printing from canvas and text widgets."
+ return
+ }
+
if {[tk windowingsystem] eq "win32"} {
set txt [$w get 1.0 end]
set x [file join $::env(TEMP) tk_output.txt]