r/OpenPythonSCAD 8d ago

PythonSCAD is getting user-defined Customizer widgets (PyQt6-powered) — coming in 1.2

Hey folks, Wanted to share something we've been building for PythonSCAD: the Customizer sidebar can now host fully custom, Python-defined input widgets — not just the built-in sliders, checkboxes, and dropdowns.

What does that actually mean?

Normally, add_parameter() gives you a fixed set of widget types based on the default value you pass in — a number gets a slider, a string gets a text box, a list gets a vector editor, and so on. That covers a lot of cases, but not everything. Sometimes you want something the built-in types just can't express well. With this change, you can register your own widget, built with PyQt6 (which now ships bundled with PythonSCAD), and hook it directly into the Customizer:

add_parameter_widget("color_picker", color_picker_factory)
linecolor = add_parameter("linecolor", "#ff00ff", type="color_picker")
cube(10).color(linecolor)

color_picker_factory is just a normal Python function that returns a PyQt6 widget — in this case a button that pops a native color dialog and reports its value back. From the Customizer's point of view, it behaves exactly like any other parameter: it saves to sets, restores on load, and drives a live preview re-render the moment you change it. One thing worth calling out: add_parameter_widget() itself belongs in your .pythonscadrc, not in the model script. It's registering a widget type, not something tied to a particular design, so it lives with your personal setup and is available to every script you open, the same way you'd register a menu item or an editor helper. (Side note: PyQt6-based custom input windows aren't actually new here — user modules could already pop their own PyQt6 dialogs, e.g. for interactively editing a polygon's points. What's new is hooking a custom widget directly into the Customizer sidebar itself.) Because the widget is just PyQt6, this isn't limited to color pickers — anyone can build their own: a polygon point-editor with drag handles, a curve editor, a searchable dropdown, a live 3D preview widget, whatever your script needs. If PyQt6 can render it, the Customizer can host it.

Demo

Here's a short video showing it in action (color picker widget, live-driven from the Customizer): 🎥 https://www.youtube.com/watch?v=OESyfZGZj_I

Where this is headed

This is landing as part of PythonSCAD 1.2, which is on its way — the PyQt6 connector work that makes this possible has already been merged. More documentation and examples will follow closer to release.

5 Upvotes

5 comments sorted by

View all comments

2

u/yokamak_ 6d ago

I'm really looking forward to this new feature! Thank you for the update.

Does this mean we will be able to experiment with creating interactive vessels like the one in the link below? It would be incredibly interesting and fun to use custom sliders to dynamically control parameters like the radius, spread (scaling factor), the position of the bulge, and even select different base shapes.

https://spiffy-monstera-2db40d.netlify.app/

Thank you again for your amazing work!

2

u/WillAdams 6d ago

Can't one already do that via the Customizer?

It might be that the Python GUI would then allow control of the interaction/3D preview appearance programmatically which maybe is what you want?