Class: Gtk::HelloWorld
- Inherits:
-
Box
- Object
- Box
- Gtk::HelloWorld
show all
- Defined in:
- lib/gtk_paradise/examples/gtk2/022_hello_world_in_gtk2_and_bold_font.rb,
lib/gtk_paradise/examples/gtk3/042_hello_world_in_gtk3_and_bold_font.rb
Constant Summary
collapse
- USE_THIS_FONT =
'Sans Bold 25'
Instance Method Summary
collapse
Methods inherited from Box
#add_space, #left_aligned_text, #text
Constructor Details
#initialize(run_already = true) ⇒ HelloWorld
21
22
23
24
25
26
27
28
29
|
# File 'lib/gtk_paradise/examples/gtk2/022_hello_world_in_gtk2_and_bold_font.rb', line 21
def initialize(
run_already = true
)
super('First example')
set_size_request(400, 400)
set_border_width(10)
run if run_already
end
|
Instance Method Details
#run ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/gtk_paradise/examples/gtk2/022_hello_world_in_gtk2_and_bold_font.rb', line 34
def run
button = ::Gtk::Button.new('Say hello')
button.signal_connect(:clicked) { |_widget|
e 'Hello World!! \\o/'
}
button.modify_font(
Pango::FontDescription.new(USE_THIS_FONT)
)
add(button)
signal_connect(:delete_event) { |_widget| ::Gtk.main_quit }
show_all
move(0, 0)
::Gtk.main
end
|