Fortran Wiki
GUI Development

GUI Development in modern Fortran

The gtk-fortran library is a set of Fortran modules that allow the GTK libraries to be called using the C interoperability features of modern Fortran. Gtk-fortran is cross-platform: Linux, MSYS2 in Windows, FreeBSD, macOS, Raspbian on Raspberry Pi… The new developments are made in the GTK 4 branch. The wiki documentation is user centered and offers tutorials, how-to, references and explanations.

gtk-fortran uses CMake for building but is also available in conda-forge. You can also use it as a simple fpm (Fortran Package Manager) dependency.

In addition to the standard GTK routines (along with GLib, GDK and Cairo) there is a high-level interface which uses Fortran’s optional argument system to create a programming interface to the most common widgets that should be more comfortable to IDL (Interactive Data Language) programmers. There is also an interface with the PLplot scientific plotting library, and additional tools.

Although the gtk-fortran project is licensed under GNU GPL v3 (with the additional permissions described in the GCC Runtime Library Exception version 3.1), there is a gtk-fortran-extra repository with examples under MIT license, that you can use to start your own GTK scientific application without worrying about license problems. These examples also demonstrates how you can obtain an application that can be built with or without its GUI.


The forGE project is “a framework designed to simplify construction of modern Fortran programs using the GTK GUI functions” from gtk-fortran.