summary refs log tree commit diff stats
path: root/examples/gtk/ex2.nim
blob: fab64cef57ee3f45650f7c4d922bfdfa280b6f95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import 
  glib2, gtk2

proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = 
  main_quit()

var 
  window: PWidget
  button: PWidget

nimrod_init()
window = window_new(WINDOW_TOPLEVEL)
button = button_new("Click me")
set_border_width(PContainer(Window), 5)
add(PContainer(window), button)
discard signal_connect(window, "destroy", 
                           SIGNAL_FUNC(ex2.destroy), nil)
show(button)
show(window)
main()