With latest nimble and nim a plain
nimble install gintro
should work now out of the box.
(Well at least for 64 bit Linux and recent GTK 3.22 -- I can currently not test Windows, MAC or 32 bit Linux)
The examples should compile and work with Nim 0.17.3 and 0.18.0.
Short tutorial at
Should work for Windows 10 also now.
As Araq recommended, I removed the single quotes in the wget and nimgrab command strings.
You just have to ensure that all needed GTK3 libs are installed on your Windows box before gintro install.
You may follow user zetashift's advise, but don't forget to install the separate file
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-gtksourceview3
Currently libvte is not included -- I never heard about it before.
For what do you use it, and have you used GTK3 seriously already?
Of course we can try to add it, which may be a trivial task, or may be some work, we have to investigate it.
Well, basically we can use Vte. Have just hacked together a minimal test:
# https://vincent.bernat.im/en/blog/2017-write-own-terminal
import gintro/[gtk, glib, gobject, gio, vte]
var cmd: array[2, cstring] = ["/bin/bash".cstring, cast[cstring](0)]
proc appActivate(app: Application) =
let window = newApplicationWindow(app)
window.title = "GTK3 & Nim"
window.defaultSize = (600, 200)
let terminal = newTerminal()
let environ = getEnviron()
var command = environ.environGetenv("SHELL")
echo command
var pid = 0
echo terminal.spawnSync(cast[PtyFlags](0), nil, cast[ucstringArray](unsafeaddr(cmd)),
nil, {SpawnFlag.leaveDescriptorsOpen}, nil, nil, pid, nil)
window.add(terminal)
showAll(window)
proc main =
let app = newApplication("org.gtk.example")
connect(app, "activate", appActivate)
discard run(app)
main()
That code opens indeed a working linux terminal. But it is obvious that libvte is not that trivial and will need some manual tuning, for example for the cstringArray parameters. And I do not know much about libvte and have no real use case for it. I will push the fixed gintro package to github in the next days, so you may play with it yourself.
[EDIT] Done!
Is this Library considered the proper way to do a GUI application in Nim?
No!