E
Ed Redman
Hello all
I have written a simple program to run an external system application.
When the application finishes the focus does not return to the ruby/tk
application. It does not function. Eventually it quits but not in a
proper fashion.
Here is the program. I hope someone can help.
#!/usr/bin/ruby
require 'tk'
root = TkRoot.new
root.title "Execute Program"
$text = TkVariable.new
frame = TkFrame.new(root)
frame.borderwidth 10
frame.pack( 'side' => 'top')
frame.pack('fill' => 'x')
toprun = TkButton.new(frame)
toprun.text "Run it"
toprun.command{ `#{$text}`}
toprun.pack( 'side' => "right")
topquit = TkButton.new(frame)
topquit.text "Exit"
topquit.command{ exit }
topquit.pack('side' => "right")
label = TkLabel.new(frame)
label.text "Command"
label.pack("padx" => 0)
entry = TkEntry.new(frame)
entry.textvariable $text
entry.width 20
entry.relief 'sunken'
entry.pack("side" => "left")
entry.pack("fill" => "x")
entry.pack("expand" => "true")
Tk.mainloop
I have written a simple program to run an external system application.
When the application finishes the focus does not return to the ruby/tk
application. It does not function. Eventually it quits but not in a
proper fashion.
Here is the program. I hope someone can help.
#!/usr/bin/ruby
require 'tk'
root = TkRoot.new
root.title "Execute Program"
$text = TkVariable.new
frame = TkFrame.new(root)
frame.borderwidth 10
frame.pack( 'side' => 'top')
frame.pack('fill' => 'x')
toprun = TkButton.new(frame)
toprun.text "Run it"
toprun.command{ `#{$text}`}
toprun.pack( 'side' => "right")
topquit = TkButton.new(frame)
topquit.text "Exit"
topquit.command{ exit }
topquit.pack('side' => "right")
label = TkLabel.new(frame)
label.text "Command"
label.pack("padx" => 0)
entry = TkEntry.new(frame)
entry.textvariable $text
entry.width 20
entry.relief 'sunken'
entry.pack("side" => "left")
entry.pack("fill" => "x")
entry.pack("expand" => "true")
Tk.mainloop