Personal tools

Cookbook/Graphical user interfaces

From HaskellWiki

< Cookbook(Difference between revisions)
Jump to: navigation, search
 
(smaller headlines)
 
Line 1: Line 1:
= wxHaskell =
+
== wxHaskell ==
 
[[WxHaskell|wxHaskell]] is a portable and native GUI library for Haskell based on the wxWidgets Library.
 
[[WxHaskell|wxHaskell]] is a portable and native GUI library for Haskell based on the wxWidgets Library.
   
Line 21: Line 21:
 
This code was taken from [[WxHaskell/Quick_start | "a quick start with wxHaskell"]].
 
This code was taken from [[WxHaskell/Quick_start | "a quick start with wxHaskell"]].
   
= Gtk2Hs =
+
== Gtk2Hs ==
 
[http://haskell.org/gtk2hs/screenshots/ Gtk2Hs] is a GUI Library for
 
[http://haskell.org/gtk2hs/screenshots/ Gtk2Hs] is a GUI Library for
 
Haskell based on GTK. [http://home.telfort.nl/sp969709/gtk2hs/ Gtk2Hs Tutorial].
 
Haskell based on GTK. [http://home.telfort.nl/sp969709/gtk2hs/ Gtk2Hs Tutorial].
Line 46: Line 46:
 
For more examples, see: [[Applications and libraries/Games]]
 
For more examples, see: [[Applications and libraries/Games]]
   
= HOpenGL =
+
== HOpenGL ==
 
[http://www.haskell.org/HOpenGL/ HOpenGL] is a Haskell binding for the OpenGL graphics API (GL 1.2.1 / GLU 1.3) and the portable OpenGL utility toolkit GLUT.
 
[http://www.haskell.org/HOpenGL/ HOpenGL] is a Haskell binding for the OpenGL graphics API (GL 1.2.1 / GLU 1.3) and the portable OpenGL utility toolkit GLUT.
 
There is a Haskell OpenGL Tetris program at
 
There is a Haskell OpenGL Tetris program at
Line 53: Line 53:
 
See also: [[Applications and libraries/Games]]
 
See also: [[Applications and libraries/Games]]
   
= SDL =
+
== SDL ==
 
There are some Haskell bindings to [http://libsdl.org/ SDL] at [http://hackage.haskell.org/packages/archive/pkg-list.html Hackage].
 
There are some Haskell bindings to [http://libsdl.org/ SDL] at [http://hackage.haskell.org/packages/archive/pkg-list.html Hackage].

Latest revision as of 11:34, 9 July 2009

Contents

[edit] 1 wxHaskell

wxHaskell is a portable and native GUI library for Haskell based on the wxWidgets Library.

Hello World example:

module Main where
import Graphics.UI.WX
 
main :: IO ()
main
  = start hello
 
hello :: IO ()
hello
  = do f    <- frame    [text := "Hello!"]
       quit <- button f [text := "Quit", on command := close f]
       set f [layout := widget quit]

This code was taken from "a quick start with wxHaskell".

[edit] 2 Gtk2Hs

Gtk2Hs is a GUI Library for Haskell based on GTK. Gtk2Hs Tutorial.

Hello world example:

import Graphics.UI.Gtk
 
main :: IO ()
main = do
    initGUI
    w <- windowNew
    b <- buttonNew
    set b [buttonLabel := "Quit"]
    onClicked b $ widgetDestroy w
    set w [windowTitle := "Hello", containerBorderWidth := 10]
    containerAdd w b
    onDestroy w mainQuit
    widgetShowAll w
    mainGUI

For more examples, see: Applications and libraries/Games

[edit] 3 HOpenGL

HOpenGL is a Haskell binding for the OpenGL graphics API (GL 1.2.1 / GLU 1.3) and the portable OpenGL utility toolkit GLUT. There is a Haskell OpenGL Tetris program at [[1]] by Jim.

See also: Applications and libraries/Games

[edit] 4 SDL

There are some Haskell bindings to SDL at Hackage.