lets see how it looks
This commit is contained in:
parent
f263f1d209
commit
02abf4f70a
1 changed files with 23 additions and 23 deletions
46
README.adoc
46
README.adoc
|
|
@ -13,29 +13,29 @@ Version 0.1 2017
|
||||||
(c) Stefan Salewski +
|
(c) Stefan Salewski +
|
||||||
2017
|
2017
|
||||||
|
|
||||||
NOTE: This work is partly based on earlier works of _J. Mansour_ and has been supported by _A. Rumpf_ and other _Nim_ and _GTK/Gnome_ developers.
|
NOTE: This work is partly based on earlier works of J. Mansour and has been supported by A. Rumpf and other _Nim_ and _GTK/Gnome_ developers.
|
||||||
The `combinatorics` module was kindly provided by _R. Behrends_.
|
The `combinatorics` module was kindly provided by R. Behrends.
|
||||||
|
|
||||||
//icon:thumbs-up[]
|
//icon:thumbs-up[]
|
||||||
This repository contains bindings from the _Nim_ programming language to the _GTK3_ _GUI_ (_Graphical User Interface_) library and related libraries. (With minimal fixes
|
This repository contains bindings from the Nim programming language to the GTK3 _GUI_ (_Graphical User Interface_) library and related libraries. (With minimal fixes
|
||||||
it should also work for upcoming _GTK4_.)
|
it should also work for upcoming _GTK4_.)
|
||||||
|
|
||||||
https://nim-lang.org/[Nim] is a modern universal programming language.
|
https://nim-lang.org/[Nim] is a modern universal programming language.
|
||||||
|
|
||||||
https://www.gtk.org/[GTK], also known as the _Gimp Tool Kit_ and now sometimes also called _Gnome Tool Kit_, is a _Graphical User Interface_ library.
|
https://www.gtk.org/[GTK], also known as the _Gimp Tool Kit_ and now sometimes also called _Gnome Tool Kit_, is a Graphical User Interface library.
|
||||||
|
|
||||||
NOTE: Later we will insert at this location a nice picture of a fancy _Nim GTK3 GUI_. Such a picture is fine to attract users and indeed is a good motivation.
|
NOTE: Later we will insert at this location a nice picture of a fancy Nim GTK3 GUI. Such a picture is fine to attract users and indeed is a good motivation.
|
||||||
But such pictures are no real evidence for the quality of a _GUI_ toolkit -- the concrete example may look nice, while the toolkit
|
But such pictures are no real evidence for the quality of a GUI toolkit -- the concrete example may look nice, while the toolkit
|
||||||
looks much worse in other environments and offers by far not all that what is needed in real life.
|
looks much worse in other environments and offers by far not all that what is needed in real life.
|
||||||
|
|
||||||
While _GTK_ was initially designed and advertised as cross platform _GUI_ toolkit, it is currently mostly used on _Linux_ and other _Unix_ like operation systems.
|
While GTK was initially designed and advertised as cross platform GUI toolkit, it is currently mostly used on _Linux_ and other _Unix_ like operation systems.
|
||||||
Most _Linux_ distributions include it, and some use it for their default desktop environment, often with the _Gnome_ environment or other window managers.
|
Most Linux distributions include it, and some use it for their default desktop environment, often with the Gnome environment or other window managers.
|
||||||
While _GTK2_ applications like _GIMP_ are still used on _Windows_, there seems to exist currently only very few _GTK3_ applications for _Windows_ or _{MAC}_.
|
While GTK2 applications like _GIMP_ are still used on _Windows_, there seems to exist currently only very few GTK3 applications for Windows or {MAC}.
|
||||||
When you develop primary _free open source software_ (_FOSS_) for _Linux_ or other _Unix_ like operating systems, then _GTK3_ is a good choice for you. With some
|
When you develop primary _free open source software_ (_FOSS_) for Linux or other Unix like operating systems, then GTK3 is a good choice for you. With some
|
||||||
effort you should be even able to port your application to the proprietary _Windows_ or _{MAC}_ operating systems. But when your primary target platforms
|
effort you should be even able to port your application to the proprietary Windows or {MAC} operating systems. But when your primary target platforms
|
||||||
are _Windows_ and _{MAC}_ and you desire a real native look and feel there, then you may find better suited ones in the _Nim_ software repository.
|
are Windows and {MAC} and you desire a real native look and feel there, then you may find better suited ones in the Nim software repository.
|
||||||
Also, when you only need a minimal restricted _GUI_ which is very easy to install on _Windows_ and _{MAC}_, then you may find better suited packages
|
Also, when you only need a minimal restricted GUI which is very easy to install on Windows and {MAC}, then you may find better suited packages
|
||||||
in the _Nim_ package repository. _Android OS_ is currently not supported by _GTK_ at all.
|
in the Nim package repository. _Android OS_ is currently not supported by GTK at all.
|
||||||
|
|
||||||
While low level _Nim_ bindings for _GTK3_ are already available since a few years, this one is an attempt to
|
While low level _Nim_ bindings for _GTK3_ are already available since a few years, this one is an attempt to
|
||||||
provide real high level bindings with full type safety, full _Garbage Collector_ (_GC_) support and an idiomatic
|
provide real high level bindings with full type safety, full _Garbage Collector_ (_GC_) support and an idiomatic
|
||||||
|
|
@ -170,7 +170,7 @@ We start with a minimal traditional old style example, which should be familiar
|
||||||
.t0.nim
|
.t0.nim
|
||||||
----
|
----
|
||||||
# nim c t0.nim
|
# nim c t0.nim
|
||||||
import gtk
|
import gintro/gtk
|
||||||
|
|
||||||
proc bye(w: Window) =
|
proc bye(w: Window) =
|
||||||
mainQuit()
|
mainQuit()
|
||||||
|
|
@ -204,9 +204,9 @@ differences between the source code displayed here and the sources in examples d
|
||||||
----
|
----
|
||||||
# app0.nim -- minimal application style example
|
# app0.nim -- minimal application style example
|
||||||
# nim c app0.nim
|
# nim c app0.nim
|
||||||
import gtk
|
import gintro/gtk
|
||||||
import gio except Application, newApplication # we want to use GTK application
|
import gintro/gio except Application, newApplication # we want to use GTK application
|
||||||
#from gio import ApplicationFlags, scActivate, run
|
#from gintro/gio import ApplicationFlags, scActivate, run
|
||||||
|
|
||||||
proc activate(app: Application) =
|
proc activate(app: Application) =
|
||||||
let window = newApplicationWindow(app)
|
let window = newApplicationWindow(app)
|
||||||
|
|
@ -257,7 +257,7 @@ at https://developer.gnome.org/gnome-devel-demos/.
|
||||||
The https://developer.gnome.org/gnome-devel-demos/3.22/c.html.en[C demos] seems to be most actual and complete,
|
The https://developer.gnome.org/gnome-devel-demos/3.22/c.html.en[C demos] seems to be most actual and complete,
|
||||||
and are easy to port to _Nim_. So we start with these,
|
and are easy to port to _Nim_. So we start with these,
|
||||||
but if you are familiar with the other listed languages, then you can try to port them to _Nim_ as well.
|
but if you are familiar with the other listed languages, then you can try to port them to _Nim_ as well.
|
||||||
Let us start with https://developer.gnome.org/gnome-devel-demos/3.22/button.c.html.en -- it is
|
Let us start with https://developer.gnome.org/gnome-devel-demos/3.22/button.c.html.en as it is
|
||||||
still short and easy to understand, but shows already some interesting topics.
|
still short and easy to understand, but shows already some interesting topics.
|
||||||
|
|
||||||
image::NimGTK3Button.png[]
|
image::NimGTK3Button.png[]
|
||||||
|
|
@ -342,8 +342,8 @@ this:
|
||||||
.button.nim
|
.button.nim
|
||||||
----
|
----
|
||||||
# nim c button.nim
|
# nim c button.nim
|
||||||
import gtk, glib
|
import gintro/[gtk, glib]
|
||||||
import gio except Application, newApplication
|
import gintro/gio except Application, newApplication
|
||||||
|
|
||||||
proc buttonClicked (button: Button) =
|
proc buttonClicked (button: Button) =
|
||||||
button.label = utf8Strreverse(button.label, -1)
|
button.label = utf8Strreverse(button.label, -1)
|
||||||
|
|
@ -415,8 +415,8 @@ happens when you click on the buttons.
|
||||||
.connect_args.nim
|
.connect_args.nim
|
||||||
----
|
----
|
||||||
# nim c connect_args.nim
|
# nim c connect_args.nim
|
||||||
import gtk, glib
|
import gintro/[gtk, glib]
|
||||||
import gio except Application, newApplication
|
import gintro/gio except Application, newApplication
|
||||||
|
|
||||||
type
|
type
|
||||||
O = object
|
O = object
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue