Can i make it full screen?

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?

2010/8/7, Pen T. [email protected]:

    end

Gtk.main
http://p.sf.net/sfu/RIM-dev2dev


ruby-gnome2-devel-en mailing list
[email protected]
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 C.


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

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+?

gdk_screen=window.screen
and not
window.gdk_screen=screen

variable=objet.method!!


Vincent C.


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

think for Vincent C.,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 methodgdk_screen’ for
main:Object
from (irb):27
from :0

would you mind to tell me how to fix it?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs