Questions tagged [gtk2hs]

Gtk2Hs is a GUI library for Haskell based on Gtk+. Gtk+ is an extensive and mature multi-platform toolkit for creating graphical user interfaces.

Gtk2Hs is a GUI library for Haskell based on Gtk+. Gtk+ is an extensive and mature multi-platform toolkit for creating graphical user interfaces.

Gtk2Hs features:

  • Automatic memory management.
  • Nearly complete coverage of the Gtk+ API.
  • Unicode support.
  • Extensive reference documentation.
  • Support for Linux, Windows, MacOS X and Unix platforms.
  • Support for several related GtK+ and Gnome modules:
    • the Glade visual user interface builder.
    • the cairo vector graphics library.
    • rendering of SVG images using cairo (via librsvg)
    • the Gtk+ OpenGL extension.
    • GConf for storing application preferences.
    • SourceView, an editor widget with syntax highlighting.
    • the Mozilla browser rendering engine in a Gtk+ widget
  • An implementation of the Graphics.SOE API.

Gtk+ and Gtk2Hs are Free software liscenced under the GNU LGPL.

157 questions
2
votes
0 answers

How do I render a CellRenderer to a Cairo Drawable?

The documentation for gtk2hs CellRenderer says: The primary use of a CellRenderer is for drawing a certain graphical elements on a Drawable Looking at the corresponding page for GTK+ I see it has a function render(cr, widget, background_area,…
Paul Johnson
  • 17,438
  • 3
  • 42
  • 59
2
votes
1 answer

In Gtk2hs, why do TreeModelIface functions sometimes take an Iter, sometimes a Maybe Iter

In Gtk2hs there is the Graphics.UI.Gtk.ModelView.CustomStore module, which includes a data type containing a collection of functions, TreeModelIface. It contains a bunch of functions for navigating around a user-defined tree type where the location…
Paul Johnson
  • 17,438
  • 3
  • 42
  • 59
2
votes
1 answer

How to handle Quit command (Cmd-Q) in Mac OS X in Haskell gtk2hs

I'm experimenting with the sample program at https://github.com/gtk2hs/gtk2hs/blob/master/gtk/demo/hello/World.hs, reproduced below: -- A simple program to demonstrate Gtk2Hs. module Main (Main.main) where import Graphics.UI.Gtk main :: IO () main…
Richard Cook
  • 32,523
  • 5
  • 46
  • 71
2
votes
0 answers

Haskell & Gtk : how to draw points as soon as they are computed

I created a working program displaying the Mandelbrot set, but the whole set is displayed after all is computed; I wonder which changes of the code I must do in order to have a points displayed as soon as it's known if it belongs to the set or…
lolveley
  • 1,659
  • 2
  • 18
  • 34
2
votes
1 answer

Adding a MenuItem to a Menu in Gtk2hs

I want to create a popup GTK Menu and then add some MenuItems to it. I found this bit of sample code for popup menus but it was bitrotted. The fixed version is below. Look for the comment "This is the bit that doesn't work!". The trouble is that the…
Paul Johnson
  • 17,438
  • 3
  • 42
  • 59
2
votes
1 answer

onExpose function deprecated

I'm using Gtk2Hs to build a GUI drawing some picture in a window. I use the function onExpose to connect the expose event to the redrawing function. onExpose canvas $ \_ -> do refreshArea canvas ... return True Things are working but…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
2
votes
0 answers

labelSetText behaves strange when executed in timeoutAdd handler

I wrote a simple clock program that worked fine under winxp. When run under linux it behaves weirdly. The program draws a label with the text set to "00:00", and then updates it once per second with the same text. To run the program I specify a…
Anton
  • 279
  • 2
  • 9
2
votes
2 answers

Couldn't match expected type `()' with actual type `Int'

I have a strange error with Haskell and Gtk2Hs. I try to set the cursor position in a text entry with set entree [entryCursorPosition := 5 ] which correspond to the Type entryCursorPosition :: EntryClass self => ReadAttr self Int and I have…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
2
votes
2 answers

gtk : combo of pictures in a treeview

I'm trying to make a combo box of pictures (as bellow) inside a treeview cell to make a selection. I tried to use a cellRendererComboNew to render the combo but the options to fill the combobox cellComboTextModel := work only for String and I can't…
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
2
votes
0 answers

Screen capture with gtk2hs using gtk3

I'm aware that using gtk2 it was possible to capture a screen into a pixbuf using gtk2hs. The solution is given here: Screen capture in Haskell?. The problem is that pixbufGetFromDrawable is absent in gtk3 (at least in gtk2hs). Can somebody…
Aurimas
  • 71
  • 3
2
votes
1 answer

Gtk2hs give runtime error "Require gtk+ version 3"

I am writing a small application using the gtk2hs, but i get the below error on running the application. required gtk+ version 3.10, current version is 2.24 Also i checked (using ldd) that the below library is linked to my…
dfordivam
  • 169
  • 1
  • 6
2
votes
1 answer

How to display an image from Repa-DevIL in gtkImage in haskell

I'm working on an image processing program in Haskell. The Repa-DevIL library is good one for image processing. However, I need a GUI which can display the image in real time as it is being processed. How can I use gtkImage to diaplay an image of…
iceiceice
  • 187
  • 1
  • 6
2
votes
1 answer

gtk2hs - converting Color to a hex triplet

I'm working in Haskell with gtk2hs, and have come across a problem I can't find an answer to. I am writing a very simple program: it takes a colour value (or multiple colour values), and then will apply a function to them. It can do things like…
2
votes
1 answer

How to get cursor position in TextView in gtk2hs?

I have a TextView with assigned non-empty TextBuffer. How to get current cursor position in TextView? Or how to get current TextIter on cursor?
Anon Imous
  • 415
  • 2
  • 11
2
votes
1 answer

Designing loosely coupled components with GTKs event model

This is a fairly vague and open ended question, but hopefully someone can still provide some insight. I am using GTK (through Gtk2Hs with Haskell via GHC) and I am wondering if there is any general advice for handling events. I am used to keeping…
Necrototem
  • 554
  • 6
  • 12