summaryrefslogtreecommitdiffstats
path: root/library/print.tcl
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2021-05-23 14:45:43 (GMT)
committerKevin Walzer <kw@codebykevin.com>2021-05-23 14:45:43 (GMT)
commit9c156a8ee53daeaa404076997c8d4fc1d2189608 (patch)
tree5ae8d67288b3eebb58bf05a89b9951d62e64f2c4 /library/print.tcl
parenta327016f886dab6a6fc066ead899d25c4234ff3f (diff)
downloadtk-9c156a8ee53daeaa404076997c8d4fc1d2189608.zip
tk-9c156a8ee53daeaa404076997c8d4fc1d2189608.tar.gz
tk-9c156a8ee53daeaa404076997c8d4fc1d2189608.tar.bz2
More work on widget demo
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]