如何得到当前某程序使用的图标?

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
上面的ruby代码运行后,可以全屏,下面的就不行,不知错误在哪里?
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

作者: 罗非鱼   发布时间: 2010-08-08

不知道,gtk里一句
代码:
gtk_window_maximize

就OK了

作者: slax   发布时间: 2010-08-09