Formation
Emmanuel Obara
Jul 08, 2021
1 Installation
2 Quick Start
3 Simple Calculator
4 Formation
5 Hoverset
6 Studio
7 Indices and tables
Python Module Index
Index
GETTING STARTED
1
3
5
13
19
41
47
49
51
i
ii
CHAPTER
ONE
INSTALLATION
To use Formation studio, python 3.6 or higher is required. You can download and install python here.
Formation studio can be installed using pip:
pip install formation-studio
Note: Some linux distributions do not include pip and require you to install it separately. You can follow these
instructions to do so.
If you are using multiple versions of python, pip can install Formation studio on a per version basis. For example, if
you wanted to specify python 3.7:
pip3.7 install formation-studio
1.1 Installation on Linux
Formation studio uses tkinter that (depending on your distribution) may or may not be included by default. If you are
using tkinter for the first time it is advised to install tkinter and imagetk.
For Debian based distributions (i.e. Ubuntu) you would use the following:
sudo apt-get install python3-tk, python3-pil.imagetk
Note: If your distribution is not Debian based you will need to subsitute the appropriate installation commands as per
your distribution. Furthermore, Formation studio does not support python 2. Please ensure you install python 3
packages only.
1
Formation
1.2 Launching Formation studio
Once installed you can launch Formation studio from the command line using the following command:
formation-studio
2
Chapter 1.
Installation
CHAPTER
TWO
QUICK START
Launch the studio from the commandline using the command
formation-studio
You can select widgets from the Components pane at the top and drag them onto the stage. Click to select widgets
on the workspace and customize them on Stylepane to the right. You can view your widget hierarchies from the
Component tree at the bottom left. To preview the the design, use the preview (“run button”) on the toolbar. After
you are satisfied with the design, save by heading to the menubar _File > Save. Below is a sample studio preview
saved as hello.xml
The underlying xml uses namespaces and is as shown below:
Note: Note: this xml file has been manually formated to make it more legible but the actual xml file is minimally
formatted since it’s not expected that the developer will need to modify the xml file manually
To load the design in your python code is as simple as:
# import the formation library which loads the design for you
from formation import AppBuilder
app = AppBuilder(path=”hello.xml”)
print(app.myLabel[“text”]) # outputs text in the label ‘Hello world!’
print(app.myButton[“text”]) # outputs text in the button ‘Click me’
app.mainloop()
Note: Note: Its advisable that you use widget names that are valid python identifiers to avoid possible issues while
use the dot syntax to access the widget from the builder object. Use the widgets exact name as specified in the design
to avoid AttributeError
4
Chapter 2. Quick Start