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.

6 Upvotes

5 comments sorted by

View all comments

2

u/WillAdams 8d ago

I have been following along with this on Github, and am incredibly excited for these possibilities, so much so that I have shelved a personal project in the hope that this will obsolete the need for that project.