Pybox is a set of GUI-based tools to help you add GUI components to your program, all without adding a lot of event-driven or GUI-specific code just to have graphics and controls in your program.
Pybox is useful for learning and students, hobbyist, and general creative, freeform development & rapid prototyping without the need to write a lot of interface code just to add a button, slider, or other control -- or to remove them.
Sagebox has been used professionally in the tech industry by companies like Pentair and Pioneer, and most recently in the semiconductor field at ASML, where it was called “that magic program.”
Pybox is a complete standalone GUI system for Python. It can also be used alongside other libraries and GUI frameworks such as Matplotlib, Tkinter, OpenCV, and SciPy.
Click for Screenshot of Sagebox used with MatplotLib 3D ● Go to Github Example
One of the main ideas behind Pybox is to provide a set of powerful GUI-based tools that are not a GUI per-se, but individual library calls that you don't need to manage. Pybox manages its own environment, so you don't have to keep track of any of the controls or widgets that are launched (unless you want to).
Pybox provides a set of GUI-based functions that you can put in your code in just one or two lines, and can just as easily remove when you want to change things around. Pybox isn't used a GUI in this sense, and is just a set of function calls.
If you want some quick controls such as buttons, sliders, or some text widgets, etc., you can add these with just one line of code, and access them in another line of code.
For example, if you want a slider and a button, all you need are these two lines:
my_slider = pybox.dev_slider("box size")
my_button = pybox.dev_button("Press me")which creates a slider labeled "box size", with a default range of 0-100 and default value of 100, followed by a button.
Pybox puts these in a window for you, and will delete them later when the program ends or the window is dismissed.
When you want to use the controls, you can just call my_slider.get_pos() and my_button.pressed(). You can also use my_slider.moved() to determine if the slider has been moved since the last time checked.
For example,
if my_slider.moved() : update_size(my_slider.get_pos())
if my_button.pressed() : print("Button was pressed!")If you want to add a range to the slider with a default, you can add to the original line:
my_slider = pybox.dev_slider("Box Size",range=(10,500),default=150)which sets the slider with a range of 10-500 and a default value of 150. You can also use floating-point sliders. Sliders, radio buttons, checkboxes, combo-boxes, list-boxes, text widgets, and other controls are this easy to use.
You can also create quick dialogs or call many different functions to help develop and use your program.
This is an example of making a program using MatplotLib more interactive by providing controls that can be used to change the nature of the two graphs while animating in real-time.
With various widgets, you can call up color selectors, date pickers, formatted message boxes, image view & img before/after windows, and so-forth.
Pybox can be used with GUI/Windows based programs or regular console mode programs. In console mode, you can use Pybox functions to help with the program user-interface, such as bringing up entry boxes and other dialogs, as well as before & after windows, color selectors, etc.
Since these are called as simple functions, you can just put them in your code without changing your style or interfering with the rest of your code.
Console-based programs can use Pybox for development even when the end-product doesn't have any UI or GUI components, or can use some of the GUI-based library calls to help with user input and program flow while developing and debugging.
pip install pybox-gui import pyboxThis program creates a Hello World program using a graphic window. Creating a graphic window is not required to use Sagebox, and is just one of many features.
You can also create controls (e.g. sliders, buttons, checkboxes) with one line of code, either in a console-only program or with more graphics features such as the graphics window created in the example.
import pybox
win = pybox.new_window(); # Create a default graphic window (not required)
win.write("Hello World",font=100,center=True) # Write "Hello World" in large font, centered in window
win.wait_for_close() # Wait for user to close the windowSagebox is actively developed and welcomes early support from developers and contributors.
Sagebox was developed as a powerful and comprehensive GUI that is also very easy to use.
It is free to use in personal and commercial Python projects.
Your contributions drive continued development, bring new features and improvements, and help fast-track Linux support. (See Sagebox Roadmap)
Consider sponsoring (or adding a star to the project) to help fund continued development.
- Fun with Coding (the real reason for Pybox) - Creative Development and Freeform Programming
- Fun With Graphics
- Standalone and External 3rd-Party Widgets
- Using Pybox with Other Packages like MatplotLib, Tkinter, SciPy, PyTorch, etc.
- 3D Graphics Primitives
- Fast Real-Time 3-D GPU Graphics
- High Performance Computing: Super-Fast AVX Multi-Threading Functions
- Pybox is useful for Students, Hobbyists, Researchers, and Professionals
- Requirements
- Coming Soon - Sagebox Roadmap
- Support Sagebox
Like many programmers, I like to program creatively as I design whatever I am doing, and Pybox was written as a powerful toolset to quickly add
(and just as easily remove) controls, widgets and other elements without having to create a lot of event-driven programming or deal with a GUI.
Pybox originally came from my consulting career so I could produce prototypes and finished products quickly, sometimes within hours, without sacrificing quality
of programming or structure. Pyboxs scale as you go, to the point so you can keep it and expand it in your release program or simply use it as a development tool
that can be compiled-out for run-time (such as when you aren't writing a program with any GUI elements at all, but use them just for development).
For me, this is what makes programming fun -- the ability to program in a more freeform, extemporaneous fashion, where I can concentrate on the code I want
to write rather than the interface code just to have a button, slider, color selector, or whatever I need.
Pybox can also be used as a full GUI when you want. Pybox has a lot of graphics and other functions to allow building GUI-based applications.
You can place specific controls, create graphic buttons, as well as use many drawing graphics functions.
Pybox can also be used as a full GUI when you want, staying out of the way when you don't.
Pybox has a lot of graphics and other functions to allow building GUI-based applications, the above collage showing some programs using the Pybox graphics
functions. For most of these programs, the Pybox usage is just a few lines of code, outputting the results of whatever the code is generating.
You can place specific controls, create graphic buttons, as well as use many drawing graphics functions.
Windows can be created with one line, such as
my_window = pybox.new_window()which will create a default window that you can then write text, draw graphics, or create controls. With various keywords, you can control the size, location, background colors, and even create real-time graphics windows.
For example, this program:
my_window = pybox.new_window()
my_window.write("Hello World!",font=150,center_xy = True)Creates the above window (size reduced for display) with "Hello World" written in a font size of 150 points.
You can also just write to the window as a regular text window, and can place widgets and other windows embedded in the window itself to create and
control the look and feel of the program.
With other functions, fun and simple programs can be created using the GPU in real-time, such as the above example.
Pybox has a lot of support for writing widgets, with many pre-made widgets coming soon now that the Alpha release is out.
Widgets can be completely standalone and used on their own with just a call, and do not need a GUI interface. Anyone can write a widget that can be
used as a standalone object for use with any program.
The above examples are the Color Selector, Dial Example Widget, LCD Example Widget, and Spline Widget.
Widgets can be embedded seamlessly into a window to create a larger GUI-based interface with little code.
The above is an example of using two widgets together to emulate or control an Arduino or other hardware.
When the dial is moved by the user, the LCD reflects the Dial value, which is also printed to the window using different colors to highlight the values. The LCD widget is placed on a circuit board image, and the Dial Widget is placed on a stucco background to emulate a wall.
A smaller child window is created to show the display, and two buttons are added to start/stop the emulation and quit the program.
There is also a nice rounded title bar on top.
Pybox is written to be self-managed and to operate as a set of library calls rather than an environment that must be maintained and managed by the program.
This allows Pybox to co-exist with other packages without interfering with their operation. While Pybox has an environment that it creates, it
is an opt-in environment, where you only use it when you want to. Otherwise, it stays out of the way.
For example, if you're in an event loop with MatplotLib, Tkinter, PyGame, etc., you can simply call out to Pybox to see if it has anything for you
and react accordingly, without having to pump its events. In other cases, you can use Pybox's environment to wait and look for events.
The above examples show using MatplotLib, OpenCV/SciPy and using graphics to output the results of neural networking applications such as PyTorch.
Circles, Squares, Triangles, and Polygons -- a few of the graphics primitives that we can play with and have fun with in programming, whether we're just learning
or thinking creatively, available in just about all languages that support graphics.
With a simple GUI interface, Pybox also has 3D graphics primitives: Sphere/Spheroid, Cube/Cuboid, Pyramids, N-sided cone sections (shown above),
Dodecahedrons and more.
Objects show the right color diffusion,reflectivity, and can be animated with different sizes, angles and lighting at 60fps and higher.
These can be used on a usual 2-D surface (x and y position relative to the window) by just drawing them, or through (x,y,z) positioning that will draw them
in their proper size, lighting, and orientation depending on the object and viewer position relative to the 3-D camera position.
These 3-D graphics primitives are fairly simple and do not require GPU programming or orientation (and can also be used with the GPU where applicable).
They are created specifically to enjoy playing around with 3-D object in a 2-D or 3-D space and learning graphics basics -- the same purpose
for 2-D primitives such as circles and squares, but with the added technology and abilities we have today in the 2020's.
The examples above are stills from a 60-fps (non-GPU) program that moves the objects and viewer around in the image, creating an impressive 3-D animated display.
Since they are stills, not shown is the 360-degree equirectangular Pybox module used in the background, which rotates the background in the proper
spatial perspective when the viewer position is changed.
You can also create your own 3-DPolygonal shapes which can be used with non-GPU graphics and GPU graphics alike.
See the 3D primitives examples -- they will be released shortly as part of the Github project.
Many more 3-D graphics primitives and functions will be added in the next few updates of Pybox.
Soon to be released, Pybox features fast, real-time 3-D GPU functions. Shown above are some examples of real-time 60fps+, high-resolution graphics using the GPU.
These are taking roughly 30us of microprocessor time when rendering over 1 million pixels.
To render 1 million changing pixels in real-time can also be done in just a few milliseconds with the multi-threading AVX functions written for
Pybox (most of which are expected to be released into open-source).
These functions will be released soon, with more coming in the next few months for creating programs with GPU-based real-time graphics.
Sagebox and Pybox was originally started as a platform to develop and explore a number of different projects, such as GPU-based projects, neural networking
and so-forth.
With Sagelight Image Editor and other projects, a lot of multi-threading AVX/SIMD code was written for very fast processing.
Now that Pybox is released, these functions will follow shortly, mostly released as open source.
Some examples are shown above, all multi-threaded AVX/SIMD functionality, such as the Gaussian/Sinc/Kernel Blur shown above, transferred from Sagelight
Image Editor and other source code, with more coming.
The example to the right shows a still from a real-time, constantly re-generated texture with 1 million polygons that is actually created on the CPU and transferred
to the GPU twice as fast as sending it directly to the GPU due to the AVX it uses -- it's actually a 2D image where it is much faster to process
the polygons, lighting, and reflections on the CPU than it is to have the GPU do it, thanks to AVX. This adds a lot of power to creating quick, easy, and
generic functions with the GPU.
Look for releases in the next few weeks after this initial Pybox release.
As mentioned in the previous section, Pybox is scalable from simple programs to more complex programs, and can be used with existing packages seamlessly and without interfering.
Since Pybox works in a procedural mode (as well as event-driven when desired) as a library and stays out of your way, with no wrappers and obscure startup or other code, its is a great tool to learn programming as well as creatively develop, rapid prototyping, and building long-term applications.
Sagebox/Pybox has just been released. It was originally started and used as a library package written for professional consulting applications to
dynamically emulate and control real-time systems.
As a first release, it supports Windows-based Python and C++.
Pybox Beta Release currently supports Python 3.7, 3.9, 3.10, 3.11, and 3.12 on Windows Platform, with a Linux version currently in-progress.
VS Code, Visual Studio 2019 and Visual Studio 2022 work perfectly with Pybox -- I recommend VS Code, with Visual 2019 as a good option. Visual Studio 2022 still seems to have some issues -- it works, but I recommend VS Code instead.
Pybox is based on community support -- donations, grants, and other financial support. And, of course, your ideas.
Here is a list of items currently in-progress and expected to be finished in the next year (most in the next few months, with some releases in the next few weeks), with your support:
Widgets and more Widgets- Widgets are a powerful aspect to Pybox, such as the Color Selector, Date Picker, and the Dial & LCD emulation example.- Other widgets are easily added, such as more Arduino emulations (i.e. 3-D Compass, more detailed LCDs, other hardware), more color selectors, dual sliders, pop up menus, and so-forth.
- Most widgets are completely standalone (i.e. color picker, spline curves, etc.) and can be called with a simple function call only (i.e. Pybox does not need to be instantiated or otherwise invoked)
Linux version- The current version started on Windows for alpha release, and the next step is LinuxUI Designer- The UI designer is like using forms (for larger, less ad-hoc-style programs) but much easier, more free-form based, and with more widgets and ability to use personalized controls.- The UI designer has already been designed, and will be finished as community input helps shape it.
Real-Time Graphics- Already present in Pybox, more real-time graphics are in-progress.3-D Graphics- Functions for 3-D graphics primitives in 2D space as well as 3-D spatial graphics are nearly complete and will be available shortly. These functions work with and without GPU-based graphics. 3-D GPU-only based functions are also coming.GPU Functions- Already midway in-progress, these functions provide a very powerful set of easy-to-use tools with the GPU for much more real-time graphicsYour Input- As mentioned, I wrote Pybox for what I do, and now that it is released, I want to write it for what you do and want to see.- Just some ideas are controls such as many different types of sliders, control motifs, Arduino Hardware emulation, etc., whatever the community wants. It's all fun to write, and since most of Sagebox/Pybox is written in itself, much of it is just about getting the right ideas.
- Just some ideas are controls such as many different types of sliders, control motifs, Arduino Hardware emulation, etc., whatever the community wants. It's all fun to write, and since most of Sagebox/Pybox is written in itself, much of it is just about getting the right ideas.
Sagebox is actively developed and welcomes support from developers and contributors.
Sagebox was developed as a free, powerful and comprehensive GUI that is also very easy to use.
It is free to use in personal and commercial Python projects.
Your contributions drive continued development and help fast-track Linux support.
If Sagebox feels like something worth supporting, consider contributing to its continued development:
- GitHub Sponsors
- [OpenCollective (Coming Soon)]















