Revision as of 21:11, 27 May 2013

Contents

1 What is it?

LGtk is a lens-based API for Gtk.
LGtk is built on Gtk2Hs.

Most Haskellers would like to use a mature FRP-based API for creating graphical user interfaces.
FRP may not be the best tool for special user interfaces, like interfaces which consists of buttons, checkboxes, combo boxes, text entries and menus only.
LGtk has a lens-based API which fits better these user interfaces.

2 Demo application

You can try the demo application with the following commands:

cabal install gtk2hs-buildtools
cabal install lgtk
lgtkdemo

3 Features

Features of lgtk-0.5

The API is closed, you can safely use any constructs as long as you obey the documented laws.

Support for asynchronous events. Using LGtk is a safe way for writing multithreaded Gtk applications.

4 Examples

4.1 Hello World

main = runWidget $ label $return"Hello World!"

return

is neded because labels may be dynamic, see the next examples.

4.2 Copy

The following applications presents an entry and a label below of it.
When a text is entered in the entry, the label is changed to the entered text.