1
Ruby/Tk does NOT support forking the process on which Tk interpreter
2
is running (unless NEVER control Tk interpreter under the forked child
3
process). In the library 'tk.rb', a Tk interpreter is initialized.
4
Therefore, if you want running Tk under a child process, please call
5
"require 'tk'" in the child process.
7
# If do fork and exec(<new Ruby/Tk>) on the child process, you can
8
# control Ruby/Tk interpreter on the child process by 'send' command
9
# of Tcl/Tk. About this, please see Tk.appsend and Tk.rb_appsend, or
10
# 'remote-tk.rb' and the sample 'sample/remote-ip_sample.rb'.
12
For example, the following sample1 will NOT work, and sample2 will
15
---<sample1: NOT work>---------------------------------------
16
require 'tk' ## init Tk interpreter under parent process
18
exit! if fork ## exit parent process
21
TkButton.new(:text=>'QUIT', :command=>proc{exit}).pack
23
-------------------------------------------------------------
25
---<sample2: will work>--------------------------------------
26
exit! if fork ## exit main process
29
require 'tk' ## init Tk interpreter under child process
30
TkButton.new(:text=>'QUIT', :command=>proc{exit}).pack
32
-------------------------------------------------------------
34
2004/05/22 Hidetoshi NAGAI