Skip to content

Instantly share code, notes, and snippets.

@wavewave
Created December 25, 2011 10:29
Show Gist options
  • Select an option

  • Save wavewave/1519078 to your computer and use it in GitHub Desktop.

Select an option

Save wavewave/1519078 to your computer and use it in GitHub Desktop.
gtk2hs: button example
import Graphics.UI.Gtk
import Control.Monad.Trans
main :: IO ()
main = do
putStrLn "file open test"
initGUI
window <- windowNew
button <- buttonNewWithLabel "test"
vbox <- vBoxNew False 0
boxPackStart vbox button PackNatural 0
containerAdd window vbox
button `on` buttonActivated $ do
liftIO $ putStrLn "button press"
window `on` deleteEvent $ tryEvent $ do
liftIO $ mainQuit
widgetShowAll window
mainGUI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment