Gtk Qt Web to make a GUI?

Dear friends,

I developed some structural design applications in Fortran.
Now I want a GUI.
I first tried Gtk. I gave up. It took me days and still no success. Each time I thought I was where I wanted, another dependency popped up.
Then I made a Web based interface. It’s OK but not exactly what I wanted. Moreover it depends on MS .NET, so I think it won’t work on other platforms. and it supposes some knowledge of C#, HTML, CSS, .NET, JavaScript, ASP.NET
I’m a retired structural engineer, no software engineer, doing this as a hobby hoping my work will be of some use for my colleagues.
I suppose I could make time to study all these items, I don’t know if it’s worth the effort.
I use DISLIN. It’s OK for graphs but not for making a modern looking interface.
So perhaps I should give Qt a chance.
Any advice?

Roger

If you are not against using Python in between I would recommend you a slightly different strategy:
Use Fortran to create your application as a Dynamic shared library > Expose it on Python using numpy.ctypeslib, on the Fortran side you would have to declare your public procedures as bind(c) the input/output arguments of those procedures shall use iso_c_binding types declaration> use streamlit to create a pretty looking GUI using Python. It is also Web based but can run locally or as sever, up to you.

Actually, for an all-Fortran solution, Gtk+ is still your best bet, since (like many other languages) Fortran’s FFI is only with C.

Having an operating system with a proper package manager could make things easier —e.g., installing Gtk+ in a Debian-derived machine is as easy as sudo apt install gtk-3-dev, even though it has layers upon layers of dependencies:

$ pkg-config gtk+-3.0 --libs --keep-system-libs 
-L/usr/lib/x86_64-linux-gnu -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

If your operating system is Windows, maybe with WSL you can enable a linux box to make things easier?

Qt, on the other hand, is a C++ set of libraries, and therefore mangling is the norm.

@hkvzjal 's general suggestion might also work, using either Python (or PyQt) or C++ as the front-end.

After 5 years of heavy use of WSL I can say that this is not a robust solution. I’ve come to understand that for Windows developers, WSL is just a facility tool to ensure that the code also works on linux, but by no means can it be seen as a replacement for native code, specially if one intends to give the application to others. So I would advise against any approach that only works on linux and that for Windows requires a WSL.

Using streamlit you avoid Qt, PyQt, C++ all together.

2 Likes

I don’t use Windows, so I have no idea how good a solution it is. I suggested it (with a question mark at the end), because it’s been on the news lately, after Microsoft open-sourced it.

1 Like

The best way to see the WSL as of today is as very friendly virtual environment to ensure cross-platform development, but not as a replacement for native applications.

I use Intel fortran for GUI on windows. It only has menu. I draw toolbars by myself with OpenGL.

Can you describe more about what you want to visualize in the GUI?

I suspect there will be buttons and other widgets. Will there be any graphics like OpenGL needed?

Perhaps include a screenshot of one of your other attempts.

I use Intel Fortran in Microsoft Visual Studio and create this interface using QuickWin:

2 Likes

Is this made with dislin?

This is exactly the interface I’m looking for. I considered QuickWin too but it is, in my opinion, very poorly documented. Could you give me some clues to get started?

Roger

By far the easiest is to use one of the example projects they supply and modify it.

Also the book by Norman Lawrence is a great help. Qwin has not really changed since the Dec/Compaq days.

OK, Thanks. I have the book

The Intel Quickwin documentation is here:

Of course, Intel Fortran offers QuickWin only under Windows. But it is possible to make such programs run in Linux using the WineHQ “emulator” (Well, Wine Is Not an Emulator :slight_smile: ).

Your example could be implemented using Silverfrost FTN95’s native Clearwin+ library. I don’t see anything in your example that’s beyond Clearwin+. Fields to enter parameters, buttons to do calculations, simple graph plotting etc, are all possible.

This was the reason i adopted FTN95 as my preferred fortran compiler about 12 years ago. I am an almost retired electrical engineer, regularly modernising my old F77 codes for the next generation of engineers.

1 Like

I’m 79 and retired since beginning of this Year.
That would be ideal but I am afraid I can’t afford that from my meager pension :slight_smile:

Roger

1 Like

Hi Roger,

hkvzjal’s suggestion to use Python to provide the GUI and then call your own code (written in whatever language) is one of the things I’ve started doing myself.
The advantage with Python is that once you have your processed data in an array (numpy or otherwise) you can then export it with modules such as drawSVG (for importing SVG directly into desktop editing tools; Word / LibreOffice etc) and such as ezdxf for export to R12 era DXF (so everyone in the world can read it).

Hope this gives you another rabbit hole to go down. :wink:

Br,
Bob

You can also consider FLTK. There is a C binding library GitHub - MoAlyousef/cfltk: C Bindings for FLTK

Thank you all for your expert advice.
I tried most of the options with varying degrees of success.
Now I’m trying Microsoft’s MFC with Visual Studio. I know, it’s MS only, and I suppose many of you hate MS, but for now it’s all I need and it saves me a lot of C++ programming.
I’m not very proficient in C++ programming, and I don’t like it much (too many curly brackets and semi-colons :grinning_face:

Roger