gtkex2.nim 426 B

1234567891011121314151617181920212223
  1. import
  2. glib2, gtk2
  3. proc destroy(widget: PWidget, data: Pgpointer){.cdecl.} =
  4. main_quit()
  5. var
  6. window: PWidget
  7. button: PWidget
  8. nim_init()
  9. window = window_new(WINDOW_TOPLEVEL)
  10. button = button_new("Click me")
  11. set_border_width(PContainer(window), 5)
  12. add(PContainer(window), button)
  13. discard signal_connect(window, "destroy",
  14. SIGNAL_FUNC(gtkex2.destroy), nil)
  15. show(button)
  16. show(window)
  17. main()