aboutsummaryrefslogtreecommitdiff
path: root/pd/tcl/pdtk_text.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'pd/tcl/pdtk_text.tcl')
-rw-r--r--pd/tcl/pdtk_text.tcl20
1 files changed, 20 insertions, 0 deletions
diff --git a/pd/tcl/pdtk_text.tcl b/pd/tcl/pdtk_text.tcl
new file mode 100644
index 00000000..bb37ccc3
--- /dev/null
+++ b/pd/tcl/pdtk_text.tcl
@@ -0,0 +1,20 @@
+
+package provide pdtk_text 0.1
+
+############ pdtk_text_new -- create a new text object #2###########
+proc pdtk_text_new {mycanvas canvasitem x y text font_size color} {
+ $mycanvas create text $x $y -tags $canvasitem -text $text -fill $color \
+ -anchor nw -font [get_font_for_size $font_size]
+ $mycanvas bind $canvasitem <Home> "$mycanvas icursor $canvasitem 0"
+ $mycanvas bind $canvasitem <End> "$mycanvas icursor $canvasitem end"
+ if {$::windowingsystem eq "aqua"} { # emacs bindings for Mac OS X
+ $mycanvas bind $canvasitem <Control-a> "$mycanvas icursor $canvasitem 0"
+ $mycanvas bind $canvasitem <Control-e> "$mycanvas icursor $canvasitem end"
+ }
+}
+
+################ pdtk_text_set -- change the text ##################
+proc pdtk_text_set {mycanvas canvasitem text} {
+ $mycanvas itemconfig $canvasitem -text $text
+}
+