| 1 |
module Main where |
| 2 |
|
| 3 |
import Graphics.UI.Gtk |
| 4 |
|
| 5 |
main = do |
| 6 |
initGUI |
| 7 |
|
| 8 |
-- Create the builder, and load the UI file |
| 9 |
builder <- builderNew |
| 10 |
builderAddFromFile builder "simple.ui" |
| 11 |
|
| 12 |
-- Retrieve some objects from the UI |
| 13 |
window <- builderGetObject builder castToWindow "window1" |
| 14 |
button <- builderGetObject builder castToButton "button1" |
| 15 |
|
| 16 |
-- Basic user interaction |
| 17 |
on button buttonActivated $ putStrLn "button pressed!" |
| 18 |
on window objectDestroy mainQuit |
| 19 |
|
| 20 |
-- Display the window |
| 21 |
widgetShowAll window |
| 22 |
mainGUI |