S
Sven Bauhan
Hi,
I'm quite new on Ruby. I tried to use Ruby/Tk to display messages in a
window. But the command on the close button does not work. It returns an
error "NoMethodError: undefinded method'iconify' for nil:NilClass".
How can I do this?
Here is the code:
require 'tk'
class NotifyDialog
def initialize
@root = TkRoot.new { title "Notification" }
TkLabel.new {
text "Message"
pack
}
TkButton.new {
text "Close"
command proc { @root.iconify() }
pack
}
end
end
if $0 == __FILE__
gui = Thread.new {
NotifyDialog.new
Tk.mainloop
}
gui.join
puts "Tk closed. Do something ..."
sleep( 1 )
puts "... done."
end
Can anyone teel me whats wrong?
Thanks,
Sven
I'm quite new on Ruby. I tried to use Ruby/Tk to display messages in a
window. But the command on the close button does not work. It returns an
error "NoMethodError: undefinded method'iconify' for nil:NilClass".
How can I do this?
Here is the code:
require 'tk'
class NotifyDialog
def initialize
@root = TkRoot.new { title "Notification" }
TkLabel.new {
text "Message"
pack
}
TkButton.new {
text "Close"
command proc { @root.iconify() }
pack
}
end
end
if $0 == __FILE__
gui = Thread.new {
NotifyDialog.new
Tk.mainloop
}
gui.join
puts "Tk closed. Do something ..."
sleep( 1 )
puts "... done."
end
Can anyone teel me whats wrong?
Thanks,
Sven