gtk2hs

How to deal with application state in Gtk2Hs

时间秒杀一切 提交于 2019-11-29 02:06:52
Trying to learn to write applications with Gtk2Hs I'm getting difficulties bridging the gap between the event driven Gtk2HS and the persistent state of my model. So to simplify, lets say that I have this simple application module Main where import Graphics.UI.Gtk import Control.Monad.State main = do initGUI window <- windowNew button <- buttonNew set button [buttonLabel := "Press me"] containerAdd window button -- Events onDestroy window mainQuit onClicked button (putStrLn ---PUT MEANINGFUL CODE HERE---) widgetShowAll window mainGUI and the state of my application is how many times the button

How to deal with application state in Gtk2Hs

你说的曾经没有我的故事 提交于 2019-11-27 16:24:40
问题 Trying to learn to write applications with Gtk2Hs I'm getting difficulties bridging the gap between the event driven Gtk2HS and the persistent state of my model. So to simplify, lets say that I have this simple application module Main where import Graphics.UI.Gtk import Control.Monad.State main = do initGUI window <- windowNew button <- buttonNew set button [buttonLabel := "Press me"] containerAdd window button -- Events onDestroy window mainQuit onClicked button (putStrLn ---PUT MEANINGFUL