From: Pen T. <rub...@an...> - 2010-08-08 12:50:29
|
think for Vincent Carmona,i get the code to get full screen require 'gtk2' class RubyApp < Gtk::Window def initialize super set_title "Center" signal_connect "destroy" do Gtk.main_quit end decorated=false move 0, 0 gdk_screen=screen resize gdk_screen.width, gdk_screen.height show end end window = RubyApp.new Gtk.main but ,why i can't use the code in the following codes? require 'gtk2' def callback(widget) puts "Hello again - #{widget.label}(#{widget}) was pressed." end window = Gtk::Window.new window.title = "Hello Buttons" window.border_width = 10 window.signal_connect('delete_event') do Gtk.main_quit false end box1 = Gtk::HBox.new(false, 0) window.add(box1) button1 = Gtk::Button.new("Button 1") button1.signal_connect( "clicked" ) do |w| callback(w) end box1.pack_start(button1, true, true, 0) button2 = Gtk::Button.new("Button 2") button2.signal_connect("clicked") do |w| callback(w) end box1.pack_start(button2, true, true, 0) window.decorated=false window.move 0, 0 window.gdk_screen=screen window.resize gdk_screen.width, gdk_screen.height window.show_all Gtk.main the output is: irb(main):026:0> window.gdk_screen=screen NameError: undefined local variable or method `screen' for main:Object from (irb):26 from :0 irb(main):027:0> window.resize gdk_screen.width, gdk_screen.height NameError: undefined local variable or method `gdk_screen' for main:Object from (irb):27 from :0 would you mind to tell me how to fix it? -- Posted via http://www.ruby-forum.com/. |