Re: Recommended GUI library?

2020-03-20 Thread Neodim
Also trying to find a NIM GUI lib... TCL with Python is fine - is there any 
analog for NIM?

Function needed: Buttons, labels, text fields, tree or expanded view, grid 
placing?

Also what is the best for real time plotting of math graphics? With grig, axis, 
labels?

Dreaming to find all of it on native NIM with no dependencies...


Re: Recommended GUI library?

2020-03-18 Thread Lachu
Python have TCL in standard library (in reference implementation).


Re: Recommended GUI library?

2020-03-18 Thread oyster
the choice depends on your desire heavily. if you just need some button, 
dialogue box, most of the gui lib maybe work. but if you need grid/cell, web 
browser and math/latex, only maybe the famous wxdigets/qt, and not so famous 
iup can work.


Re: Recommended GUI library?

2020-03-18 Thread oyster
there is a C interface to fltk by D. J. Peters for freebasic language. But 
since dynamic library is supplied, we can use FLTK-C in other language. As a 
result, I translate the rich freebasic examples into nim. You can check it at 
[https://github.com/retsyo/FLTK_nim](https://github.com/retsyo/FLTK_nim)

However, I use windows, maybe you have to adjust the code to make it runs on 
Linux.

BTW, is it possible to change the theme in FLTK? The default looking is too 
nostalgic. 


Re: Recommended GUI library?

2020-03-17 Thread cumulonimbus
Tangential: I haven't done GUI work in a long long long time, but I discovered 
FLTK in 1998 (then pre-1.0), and came back to it again and again, last time in 
2012, for the simple reason that it never flickered thanks to built-in double 
buffering - and every other toolkit, even in 2012, had cases where it did.

I don't know if it's still a problem these days, but if it s - GUI toolkit 
developers, please pay attention to it.


Re: Recommended GUI library?

2020-03-17 Thread skprime
NiGui is phenomenal.


Re: Recommended GUI library?

2019-12-11 Thread Libman
Minimalists and license purists go 
[nuklear](https://github.com/zacharycarter/nuklear-nim). 


Re: Recommended GUI library?

2019-12-11 Thread marks
OK, thanks. Docs ought to mention that.


Re: Recommended GUI library?

2019-12-11 Thread marks
QML depends on Qt which is big (like wx) compared to, say NiGui. Also Qt's 
mutli-license is a problem for some people.


Re: Recommended GUI library?

2019-12-10 Thread rockcavera
The SDL2.dll that comes with Nim is 32bits, you need to download the 64bits 
version if you are compiling a 64bits executable. I believe that is your 
problem.


Re: Recommended GUI library?

2019-12-10 Thread filcuc
Dunno i think that nimqml is enough dir most simple project. _warning_ I'm the 
author. Probably most people don't like to build and install the native c++ 
library 


Re: Recommended GUI library?

2019-12-10 Thread marks
I tried your hello example on Linux and it works fine.

But on Windows the same code gives this error: `could not load: SDL2.dll`.

My nim bin folder (containing the SDL*.dlls) in on my PATH.

I then copied SDL2*.dll from nim's bin folder to the same folder as the 
hello.nim but it still gave the same error.


Re: Recommended GUI library?

2019-12-09 Thread dawkot
Is there a good reason people often don't even mention QML in these threads?


Re: Recommended GUI library?

2019-12-09 Thread Stefan_Salewski
> Same pattern goes for gtk3. The only upto date gtk binding lacks any form of 
> API reference, and it's been a couple years.

We had the discussion (again) some days ago at GTK forum:

[https://discourse.gnome.org/t/better-documentation-for-gtk-request/2215/15](https://discourse.gnome.org/t/better-documentation-for-gtk-request/2215/15)

I have never recommended GTK for people not already familiar with GTK, as I 
know that learning GTK is some work -- more work than learning Nim for example. 
That is true for all language bindings -- for Python and D lang there is some 
documentation, for many language bindings there is nearly nothing. That is sad 
indeed. We would need a 600 pages book like the old GTK2 one of A. Krause for 
GTK3 and 4, and that for a dozen of languages bindings. The gintro page has 
already a large collection of examples -- together with other C examples or 
tutorials that offers a starting point. Of course a free book would be fine -- 
for GTK experts like Mr Bassi that may be only 1k hours of work, but for people 
like me with only basic GTK skills that would be more of course. For maybe a 
dozen Nim readers finally.

For your API reference, it is the C API and grep xxx 
~/.nimble/pkgs/gintro-0.6.1/gintro/* gtk.nim alone has 3k procs, all the gintro 
modules have about 10k procs and thousand of data types. Of course I can list 
all of them on a html page, will do it maybe over christmas. May look 
impressiv, but I am sure it is not helpful. Users with some GTK knowledge do 
not need it, and people without a clue of GTK will not benefit, they will need 
a book or at least very extended tutorials.

And finally, may I ask how many books you have written already, or how many 
great tools or libraries you have created, without being paid for it?


Re: Recommended GUI library?

2019-12-09 Thread Araq
> None of them has any API documentation, let alone any websites. It's 
> frustrating not to see any form of documentation other than "looking at 
> existing the project that uses both".

Both have documentation at the github entry page but it's a very good point 
regardless. I'll see if I'll mange to do something about that.


Re: Recommended GUI library?

2019-12-09 Thread adnan
What's Nim's killer app/library? Jester and Karax? None of them has any API 
documentation, let alone any websites. It's frustrating not to see any form of 
documentation other than "looking at existing the project that uses both".

Same pattern goes for gtk3. The only upto date gtk binding lacks any form of 
API reference, and it's been a couple years.

You are right, everyone is interested in web programming (and mobile, to add). 
But I don't see Nim provide a friendly choice for any of them.

I don't think anyone is interested in a library that has no documentation 
whatsoever. Nobody will pick it up. Nim is a fun language to write in. But the 
state of the ecosystem leaves me very frustrated.


Re: Recommended GUI library?

2019-12-09 Thread marks
I'm starting to experiment with NiGui. I'm trying to create "widgets" that 
maintain some state and that can communicate events between the child widgets 
they contain. I also want to modularise the code into separate functions and 
objects. Here's my first hack on your example 10 (see also a question in the 
code & notes after the code): 


{.experimental: "codeReordering".}

import nigui

type
MainWindow = object
window: Window
statusLabel: Label
CustomControl = object
control: Control

proc main(): void =
app.init()
var mainWindow = newMainWindow("Test #2")
mainWindow.statusLabel.text = "Click..."
mainWindow.window.show()
app.run()

proc newMainWindow(title: string): MainWindow =
result.window = newWindow(title)
result.window.width = 500
result.window.height = 500
var vbox = newLayoutContainer(LayoutVertical)
result.window.add(vbox)
result.statusLabel = newLabel()
vbox.add(result.statusLabel)

# pass in the label so that the new control can "talk: to it: is there 
a better way?
var control = newCustomControl(result.statusLabel)
control.control.width = 400
control.control.height = 400
vbox.add(control.control)
control.control.widthMode = WidthMode_Fill
control.control.heightMode = HeightMode_Fill

proc newCustomControl(label: Label): CustomControl =
result.control = newControl()

result.control.onDraw = proc (event: DrawEvent) =
let canvas = event.control.canvas
canvas.areaColor = rgb(30, 30, 30) # dark grey
canvas.fill()
canvas.setPixel(0, 0, rgb(255, 0, 0))
canvas.areaColor = rgb(255, 0, 0) # red
canvas.drawRectArea(10, 10, 30, 30)
canvas.lineColor = rgb(255, 0, 0) # red
canvas.drawLine(60, 10, 110, 40)
let text = "Hello World!"
canvas.textColor = rgb(0, 255, 0) # lime
canvas.fontSize = 20
canvas.fontFamily = "Arial"
canvas.drawText(text, 10, 70)
canvas.drawRectOutline(10, 70, canvas.getTextWidth(text),
   canvas.getTextLineHeight())

result.control.onMouseButtonDown = proc (event: MouseEvent) =
label.text = $event.button & " (" & $event.x & ", " & $event.y & ")"
# Shows where the mouse is clicked in control-relative coordinates

main()


Run

You'll notice that I had to drop the images since I couldn't get them to work 
(even though they work fine in your original example). Oh, and this runs fine 
on Windows & Linux:-)

PS I use 4 spaces for indents because I read years ago in _Code Complete_ that 
comparative studies had shown that a minimum of 3 is needed for clarity, and 
I'm used to 4 from Python;-}


Re: Recommended GUI library?

2019-12-09 Thread rayman22201
nimx: [https://github.com/yglukhov/nimx](https://github.com/yglukhov/nimx)

The documentation is lacking, but it's maintained, performant, and cross 
platform


Re: Recommended GUI library?

2019-12-09 Thread phillvancejr
Hey @marks, you're right it should be added there. It is an old package and is 
just in maintenance mode so it definitely needs some updating. I'm not the 
original creator of the bindings but I plan on making a pull sometime in the 
near future to update it with my changes and instructions for MacOS 
installation. I will also include the dylibs for MacOS as you suggested.

on MacOS we can use a terminal command called otool to list dependencies, I 
think on Linux you can use ldd or objdump and windows has dumpbin. Based on the 
quick google searching I did, I think you can use these to verify what dynamic 
libs the executable is calling out to. So on Mac I compile my executable and 
then run the tool to list all the dependencies and then I include the 
dependencies that are not System libraries guaranteed to be installed.

on MacOS the dependencies are libpng16.16.dylib, libjpeg.9.dylib and 
libtiff.6.dylib. I'm guessing these come from wxWidgets because I didn't have 
them on a test machine without wxWidgets installed, so I think these might also 
be the same ones needed on Windows and Linux with the appropriate extensions of 
course

The static variants are also included so it should be possible to statically 
link with them, though I have not tried that yet 


Re: Recommended GUI library?

2019-12-09 Thread Trustable
I'm the author of NiGui.

@rockcavera Please create an GitHub issue for the refresh issue you described. 
Maybe it's easy to fix.

@marks You're right, the documentation is still a missing part.


Re: Recommended GUI library?

2019-12-09 Thread marks
I didn't even know there was a wxWidgets port. When I searched the nimble 
package site for "gui" it didn't find it (maybe it isn't there) and nor is it 
mentioned in the Curated Packages. Probably good if you put it in one or both 
those places so people could find it:-)

Also might help if you list the .so's, .dylib's and .DLLs that need to be 
distributed with an nim executable.

Anyway, I'll give it a try!


Re: Recommended GUI library?

2019-12-09 Thread JPLRouge
I tested back and forth and it works. I even got into the code and it works. 
moreover you can use a designer or do everything by hand ...


Re: Recommended GUI library?

2019-12-09 Thread phillvancejr
Hello, I personally use the wxWidgets bindings. There isn't a ton of 
documentation on the Nim bindings specifically, but between the examples and 
wxWidgets c++ documentation, it is easy enough to navigate. Check out he 
wxWidgets window creation example I just uploaded to Rosetta Code, 
[https://rosettacode.org/wiki/Window_creation#wxWidgets](https://rosettacode.org/wiki/Window_creation#wxWidgets)

I'm on MacOS, but wxWidgets is cross platform, and the github page has 
installation instructions for Windows and Linux. I am using the pmunch branch:

[https://github.com/pmunch/wxnim](https://github.com/pmunch/wxnim)

It does have some dependencies. First of all you need to install wxWidgets 
separately then the bindings. On MacOS it calls out to some dlls that I end up 
including with the executable. There is probably a way to statically link to 
them but I haven't taken the time to try that yet. on MacOS I only need to ship 
2 dlls with my executable and they are small 


Re: Recommended GUI library?

2019-12-09 Thread enthus1ast
The best/most advanced gui library for nim is afaik gintro (gtk).

I can also recommend web view for smaller things.


Re: Recommended GUI library?

2019-12-09 Thread marks
I've now tried the "hello world" program for all those that claim to be 
cross-platform (at least Linux & Windows). Most don't actually work on Windows, 
and all but one requires at least one `.so` or `.dll`.

The one exception is [NiGui](https://github.com/trustable-code/NiGui). This is 
pure Nim so doesn't need any extra shared libraries. Also, I found it worked 
fine on both Linux and Windows. I haven't tested it for performance or for 
comprehensiveness, and the documentation is rather sparse. However, it comes 
with a whole bunch of examples which are small enough to study and learn from.

I really hope that _NiGUI_ gets the support it needs. For example, after 
decades, Python still has no native GUI library (although there have been many 
attempts, e.g., _PyGUI_ ). This makes it much harder to deploy Python GUI apps. 
Yet with _NiGUI_ deployment is easy since it is built right into the executable 
with no separate libraries.


Re: Recommended GUI library?

2019-12-08 Thread kcvinu
Everyone is focused on web programming. No one has any interest in desktop 
programming. This is the case in many programming languages, not just Nim. 


Re: Recommended GUI library?

2019-12-08 Thread rockcavera
I'm also after a GUI package for Windows and Linux (at least) that has as few 
dependencies as possible. So far I'm using NiGui, but I'm not totally 
satisfied. I tested it on Windows and it seems to have some "problems" that 
bother who is a perfectionist. This issue is taking some time to refresh the 
screen. Example: you have about 5 labels and change their text at once, you can 
see each one changing. I don't know if it's a mistake I'm making ... but it 
bothers the visual a bit.


Re: Recommended GUI library?

2019-12-08 Thread juancarlospaco
https://forum.nim-lang.org/t/5632


Re: Recommended GUI library?

2019-12-08 Thread e
There's a list of [Curated 
Packages](https://github.com/nim-lang/Nim/wiki/Curated-Packages) that include a 
GUI section. I was pleased with how easy it is to get the cross-platform nimgui 
 working.