QuickUI is a GUI toolkit and UI library wrapper around TkInter and Matplotlib for interactive one-liner toplevel UIs. It encourages scientists and developers to experiment and prototype using full fledged GUI applications. The length of programs QuickUI is designed for are basically simple one-liners entered into a REPL, thus it is possible to generate well structured and modern looking GUI windows in just a single line of code. Also, the standard Python 3 REPL and IPython both automatically display a QuickUI application without the need to explicitly state a "show-ui" command. Even though QuickUI excels at interactive one-liner experiences, it can also be used to build more complex production-ready applications and is highly extendable.
>>> import numpy as np >>> from quickui import * >>> forall(a = slider(1,10,0.1), b = slider(1,10,0.1)).show( ... plot(lambda a,b: [np.arange(1,10), np.sin(np.arange(1,10)**a) + b/a]))
The QuickUI API is built to fit into one line of code, therefore the structure of an application is utterly concise.
Each UI begins with a
forall declaration stating which variables are defined to be represented
by which GUI component.
forall(varname = input_widget, ...)
forall statement is enough to represent a whole GUI application consisting only of inputs.
__repr__ is called on a QuickUI object, the GUI automatically displays.
This behavior was set, so that the interactive toplevels instantly show UIs.
display_ui method can be called without arguments
to show the GUI object. This behavior is needed when writing scripts using QuickUI.
forall call, the
show method can be invoked with several output widgets
attached to it.
forall( varname = input_widget, ... ).show( output_widget, ... ) # optionally: .display_ui()
Each output widget takes a callback function as an argument taking every single "foralled" variable as an argument.
output_widget_constructor(lambda var1, var2, ... : ...)
InputWidget subclass defines a method with the following API:
self.do_your_thing(tk_root_widget, my_name, state)
state represents a
From within this method, the object should invoke
to set the initial value of the variable assigned to the
Then the TkInter callbacks should invoke
state.put(my_name, updated_value) to change
not only the variable silently, but to allow
OutputWidgets to react to that state change.
slider(start, end, steps = None)
entry(type, default = None)
OutputWidget subclass defines two methods with the following API:
init_ui method should be used to set up TkInter widgets,
whereas from within
update the state of those widgets should be changed
with respect to the passed variable dictionary containing
label(lambda *vars: string)
plot(lambda *vars: [xaxis, yaxis])