-
Notifications
You must be signed in to change notification settings - Fork 44
Tutorial 3
You may need to write an application that can work both with a GTK 4 graphical user interface (GUI) and as a simple command line executable because you want to enjoy your graphical application on your desktop, but you also want to be able to run it on a machine where gtk-fortran is not installed, for example a distant machine via an ssh connection. You may also want to run a long computation without its GUI to reach full speed, as there can be some performance impediment when you draw heavily on screen.
Two applications are demonstrating that feature in our gtk-fortran-extra repository:
-
my_fast_app/
: a gtk-fortran application for fast computations (ideally < 1 second). In that case, you can use the GtkApplication API. Theactivate()
GUI callback function will call the scientific computing subroutine and draw the GUI and the graphical result. In the present case, it draws a Lorenz attractor, with three planar views and a text view. The command line version will simply print the x, y, z position of the final point. -
my_long_app/
: a gtk-fortran application for long computations, with a picture that is updated regularly. In that case you can not declare a GtkApplication: you must manage the events of the GLib main loop to keep the GUI reactive during the computation. The application is drawing a Buddhabrot. The command line version will finally save a picture in portable pixmap format (PPM).
These examples are under MIT license (contrarily to the gtk-fortran repository which is under GPL), so you can begin working on your own gtk-fortran application without worrying about license problems. You can pick an app and adapt it to your own needs (see How to start my own project from a gtk-fortran example? for more information).
- Installation
- My first gtk-fortran application
- Drawing an image in a PNG file (without GUI)
- A program also usable without GUI
- Using Glade3 and gtkf-sketcher (GTK 3)
- Using gtk-fortran as a fpm dependency
- Debugging with GtkInspector
- Learning from examples
- Video tutorials
- How to start my own project from a gtk-fortran example
- git basics
- CMake basics
- Alternatives to CMake
- How to migrate to GTK 4
- How to contribute to gtk-fortran
- How to hack the cfwrapper