From: Dave Mccormick Date: 2007-09-18T06:45:56+09:00 Subject: Defining a Method Hi, I am new to Ruby from basic. I am having a hard time getting my head around the "def". I have an Entry widget for a number, a label widget for the answer, button widget to multiply entry by 2 and place in Label. I know this should/is simple, but cannot seem to get started. Here is the messed up code that I have, would someone tell me what to do? Thank you, Dave #!/usr/bin/env ruby require 'gtk2' window =Gtk::Window.new window.signal_connect("delete_event") do Gtk.main_quit false end box1 = Gtk::HBox.new(false, 0) window.add(box1) buttonE = Gtk::Button.new("Exit") buttonE.signal_connect("clicked")do Gtk.main_quit false end box1.pack_start(buttonE, false, false, 10) buttonC = Gtk::Button.new("Click") buttonC.signal_connect("clicked") { label.text=(entry.text.to_f * 2).to_s } box1.pack_start(buttonC, true, true, 10) label = Gtk::Label.new("LABEL") box1.pack_start(label, true, true, 10) entry = Gtk::Entry.new entry.set_max_length( 50 ) box1.pack_start(entry, true, true, 10) window.border_width = 100 window.show_all Gtk.main -- Posted via http://www.ruby-forum.com/.