-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.rb
executable file
·53 lines (35 loc) · 1.07 KB
/
test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'gtk3'
class RubyApp < Gtk::Window
def initialize
super
init_ui
end
def init_ui
set_border_width 10
vbox = Gtk::Box.new :vertical, 0
hbox = Gtk::Box.new :horizontal, 5
e_space = Gtk::Alignment.new 0, 0, 0, 0
vbox.pack_start e_space, :expand => true
ok_btn = Gtk::Button.new :label => "OK"
ok_btn.set_size_request 70, 30
close_btn = Gtk::Button.new :label => "Close"
close_btn.set_size_request 70, 30
hbox.add ok_btn
hbox.add close_btn
halign = Gtk::Alignment.new 1, 0, 0, 0
halign.add hbox
vbox.pack_start halign, :expand => false,
:fill => false, :padding => 5
add vbox
set_title "Buttons"
signal_connect "destroy" do
Gtk.main_quit
end
set_default_size 260, 150
set_window_position :center
show_all
end
end
#Gtk.init
window = RubyApp.new
Gtk.main