Gatakawa
My learning of Gtk basics on Haskell.
Inspired by
https://github.com/haskell-gi/haskell-gi https://github.com/haskell-gi/gi-gtk-examples/blob/master/buttonbox/ButtonBox.hs https://github.com/haskell-gi/gi-gtk-examples/blob/master/gtkbuilder/GtkBuilderTest.hs
Translating Gtk documentation
https://github.com/haskell-gi/haskell-gi#translating-from-the-c-api-to-the-haskell-gi-generated-api
Example function
GI.Gtk | Gtk |
---|---|
mainQuit | gtk_main_quit |
Makes the innermost invocation of the main loop return when it regains control.
mainQuit
https://hackage.haskell.org/package/gi-gtk-3.0.18/docs/GI-Gtk-Functions.html#v:mainQuit
gtk_main_quit
https://developer.gnome.org/gtk3/stable/gtk3-General.html#gtk-main-quit
Example property
GI.Gtk | Gtk |
---|---|
sensitive | GTK_WIDGET_SENSITIVE |
sensitive
GTK_WIDGET_SENSITIVE()
https://developer.gnome.org/gtk2/stable/GtkWidget.html#GTK-WIDGET-SENSITIVE:CAPS
Example signal
GI.Gtk | Gtk |
---|---|
onButtonClicked | “clicked” |
onButtonClicked
https://hackage.haskell.org/package/gi-gtk-3.0.18/docs/GI-Gtk-Objects-Button.html#v:onButtonClicked
The “clicked” signal
https://developer.gnome.org/gtk3/stable/GtkButton.html#GtkButton-clicked
Documentation on the Internet
Gi-Gtk Documentation
Directory listing for gi-gtk-3.0.18 documentation https://hackage.haskell.org/package/gi-gtk-3.0.18/docs/
All index https://hackage.haskell.org/package/gi-gtk-3.0.18/docs/doc-index-All.html
Gtk documentation
This document is for the GTK+ 3 library, version 3.22.26 https://developer.gnome.org/gtk3/stable/
Lots of reference material. https://developer.gnome.org/references
You can use the search button in the top right corner to search the documentation.
Tutorials
Simple C GTK+2 tutorial http://zetcode.com/gui/gtk2/
Python Gtk+3 tutorial http://python-gtk-3-tutorial.readthedocs.io/en/latest/
Working in the REPL
In terminal type stack ghci
, it will load ghci REPL in the package context.
If you do it in eshell you will get available functions auto-completion.
Typing :browse *Main
will give you a list of interesting data that can be
searched with Emacs. You can grep though the results by using following example
if you are looking for Button related information.
echo ':browse! *Main' | stack ghci | grep Button
Typing Gtk.ma
will offer auto-completion for mainquit
, pressing Enter will
prompt you the correct case.
*Main> Gtk.mainquit <interactive>:3:1: error: Not in scope: ‘Gtk.mainquit’ Perhaps you meant ‘Gtk.mainQuit’ (imported from GI.Gtk) No module named ‘Gtk’ is imported. *Main>