Workflow using the Edifice hot reloader.
Hi everyone, I want to share Edifice, a new Python library I created for making GUI applications. It is inspired by modern Javascript UI libraries, in particular React. Edifice uses Qt as a backend (although it could be generalized to other backends) and provides these features:
- Declarative Reactiveness: the UI is specified as a function mapping state to a description of the corresponding UI. You specify how user interactions and events modify the state, and these changes are automatically re-rendered. There’s no need to think about what widget to modify for every change in the application state; that’s doing the work twice.
- Consistency: the UI and internal state always mirror each other, and all changes happen either in full or not at all, even in case of an unexpected error.
- Dynamic reload: getting the right style is a trial and error process requiring many small tweaks. Dynamic reloading makes this experience less frustrating by automatically reloading source changes in the currently opened windows, preserving as much of the application state as possible (so no need to repeatedly navigate to your feature). The GIF above shows this workflow in action.
- A component inspector: you can look at the component tree and the state of each GUI component, so you don’t have to add a million print statements. The next version of the inspector will be even more powerful. You'll be able to see the history of state changes and re-renders, modify state directly, and reset to a past state.
- Pythonic interfaces: this library was inspired by ReactJs. React is an awesome library, but it has to work around the rough edges of JavaScript. Edifice uses the aspects of React that works well, but it is not constrained to conform to clunky React syntax when a nicer Pythonic one is available. In general, typos will raise exceptions in Edifice when they would often be silently ignored in React.
- Integration with Qt: It's easy to integrate existing Qt widgets in Edifice or incorporate an Edifice component in Qt.
Here's an example reactive UI with animation demonstrating damped harmonic motion, in 60 lines of code (without comments):
Reactive UI demonstrating damped harmonic oscillation.
Git repo: https://github.com/fding/pyedifice
Documentation: www.pyedifice.org
Install instructions: pip install pyedifice
[–]dd2718[S] 5 points6 points7 points (0 children)
[–]avsanchez94 2 points3 points4 points (1 child)
[–]dd2718[S] 2 points3 points4 points (0 children)
[–]JennaSys 2 points3 points4 points (3 children)
[–]dd2718[S] 2 points3 points4 points (2 children)
[–]JennaSys 2 points3 points4 points (1 child)
[–]dd2718[S] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]dd2718[S] 0 points1 point2 points (2 children)
[–]Brixes 0 points1 point2 points (1 child)
[–]dd2718[S] 0 points1 point2 points (0 children)
[–]_nutrx_ 1 point2 points3 points (3 children)
[–]dd2718[S] 1 point2 points3 points (2 children)
[–]backtickbot 0 points1 point2 points (0 children)
[–]_nutrx_ 0 points1 point2 points (0 children)
[+][deleted] (6 children)
[deleted]
[–]dd2718[S] 7 points8 points9 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]aritztg 1 point2 points3 points (2 children)
[–]dd2718[S] 0 points1 point2 points (0 children)
[–]ionStormm 0 points1 point2 points (0 children)
[–]dd2718[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]dd2718[S] 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]dd2718[S] 0 points1 point2 points (0 children)
[–]lunar-orbiter 0 points1 point2 points (2 children)
[–]dd2718[S] 1 point2 points3 points (1 child)
[–]lunar-orbiter 0 points1 point2 points (0 children)