# Graphical

### Tk:

```ruby
var tk = require('Tk')
var main = %O<MainWindow>.new
main.Button(
    '-text'    => 'Goodbye, World!',
    '-command' => 'exit',
).pack
tk.MainLoop
```

### Gtk2:

```ruby
var gtk2 = require('Gtk2') -> init
 
var window = %O<Gtk2::Window>.new
var label  = %O<Gtk2::Label>.new('Goodbye, World!')
 
window.set_title('Goodbye, World!')
window.signal_connect(destroy => { gtk2.main_quit })
 
window.add(label)
window.show_all
 
gtk2.main
```

### Gtk3:

```ruby
use('Gtk3 -init')

var gtk3   = %O'Gtk3'
var window = %O'Gtk3::Window'.new
var label  = %O'Gtk3::Label'.new('Goodbye, World!')

window.set_title('Goodbye, World!')
window.signal_connect(destroy => { gtk3.main_quit })

window.add(label)
window.show_all

gtk3.main
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trizen.gitbook.io/sidef-lang/programming_tasks/h/hello-world/graphical.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
