Scope of this package
GtkReactive is a package building on the functionality of Gtk.jl and Reactive.jl. Its main purpose is to simplify the handling of interactions among components of a graphical user interface (GUI).
Creating a GUI generally involves some or all of the following:
creating the controls
arranging the controls (layout) in one or more windows
specifying the interactions among components of the GUI
(for graphical applications) canvas drawing
(for graphical applications) canvas interaction (mouse clicks, drags, etc.)
GtkReactive is targeted primarily at items 1, 3, and 5. Layout is handled by Gtk.jl, and drawing (with a couple of exceptions) is handled by plotting packages or at a lower level by Cairo.
GtkReactive is suitable for:
"quick and dirty" applications which you might create from the command line
more sophisticated GUIs where layout is specified using tools like Glade
For usage with Glade, the Input widgets and Output widgets defined by this package allow you to supply a preexisting
widget (which you might load with GtkBuilder) rather than creating one from scratch. Users interested in using GtkReactive with Glade are encouraged to see how the
player widget is constructed (see
At present, GtkReactive supports only a small subset of the widgets provided by Gtk. It is fairly straightforward to add new ones, and pull requests would be welcome.
The central concept of Reactive.jl is the
Signal, a type that allows updating with new values that then triggers actions that may update other
Signals or execute functions. Your GUI ends up being represented as a "graph" of Signals that collectively propagate the state of your GUI. GtkReactive couples
Signals to Gtk.jl's widgets. In essence, Reactive.jl allows ordinary Julia objects to become the triggers for callback actions; the primary advantage of using Julia objects, rather than Gtk widgets, as the "application logic" triggers is that it simplifies reasoning about the GUI and seems to reduce the number of times ones needs to consult the Gtk documentation.
Because these can sometimes be a source of bugs, it's worth emphasizing two crucial features of Reactive.jl Signals:
Signals are asynchronous, so values will not propagate until the next time the Reactive message-handler runs
derived signals are subject to garbage-collection; you should either hold a reference to or
preserveany derived signals (for any signals that are associated with updating an on-screen widget, see also
Please see the Reactive.jl documentation for more information.