[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[Ruby/Tk] Cannot close window

Sven Bauhan

1/27/2005 10:55:00 PM

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

2 Answers

Hidetoshi NAGAI

1/28/2005 3:18:00 AM

0

Sven Bauhan

1/30/2005 3:12:00 PM

0

Thanks,

that works. For me coming from C++ as 'native' language using blocks is
unfamiliar.

Sven