blob: 0ac303ae9e16ac72c2fed9e72606935cc43d04ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#! /usr/local/bin/ruby -vd
# tcltklib ã©ã¤ãã©ãªã®ãã¹ã
require "tcltklib"
def test
# ã¤ã³ã¿ããªã¿ãçæãã
ip1 = TclTkIp.new()
# è©ä¾¡ãã¦ã¿ã
print ip1._return_value().inspect, "\n"
print ip1._eval("puts {abc}").inspect, "\n"
# ãã¿ã³ãä½ã£ã¦ã¿ã
print ip1._return_value().inspect, "\n"
print ip1._eval("button .lab -text exit -command \"destroy .\"").inspect,
"\n"
print ip1._return_value().inspect, "\n"
print ip1._eval("pack .lab").inspect, "\n"
print ip1._return_value().inspect, "\n"
# ã¤ã³ã¿ããªã¿ãã ruby ã³ãã³ããè©ä¾¡ãã¦ã¿ã
# print ip1._eval(%q/ruby {print "print by ruby\n"}/).inspect, "\n"
print ip1._eval(%q+puts [ruby {print "print by ruby\n"; "puts by tcl/tk"}]+).inspect, "\n"
print ip1._return_value().inspect, "\n"
# ããä¸ã¤ã¤ã³ã¿ããªã¿ãçæãã¦ã¿ã
ip2 = TclTkIp.new()
ip2._eval("button .lab -text test -command \"puts test ; destroy .\"")
ip2._eval("pack .lab")
TclTkLib.mainloop
end
test
GC.start
print "exit\n"
|