here is a program,
require 'gtk2'
class RubyApp < Gtk::Window
def initialize
super
set_title "Center"
signal_connect "destroy" do
Gtk.main_quit
end
set_default_size 250, 200
set_window_position Gtk::Window::POS_CENTER
show
end
end
Gtk.init
window = RubyApp.new
Gtk.main
would you mind to help me to make the window full screen?
on 2010-08-07 04:13
on 2010-08-07 16:36
2010/8/7, Pen Ttt <ruby-forum-incoming@andreas-s.net>: > end > Gtk.main > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > ruby-gnome2-devel-en mailing list > ruby-gnome2-devel-en@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en > Hi. You can drop Gtk.init unless you want to be compatible with old ruby-gnome2 (it is done in gtk2.rb). For a full screen window, add: decorated=false move 0, 0 gdk_screen=screen resize gdk_screen.width, gdk_screen.height to your class definition. -- Vincent Carmona ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
on 2010-08-08 02:20
in c gtk+, /* Get the Screen Resolution */ GdkScreen* screen; gint width, height; screen = gdk_screen_get_default(); width = gdk_screen_get_width(screen); height = gdk_screen_get_height(screen); the code can get Screen Resolution, how to write it in ruby gtk+?
on 2010-08-08 14:50
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?
on 2010-08-08 17:17
gdk_screen=window.screen and not window.gdk_screen=screen variable=objet.method!! -- Vincent Carmona ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.