Module GUI without svg file?

Is it possible to create a module GUI completely with code, without involving an svg file at all?

yes, the svg elements can be created in the module code

1 Like

Yes, just set box.size.x in the ModuleWidget subclass’s constructor.


Captain Clueless here again.

Tried this, how do I draw the panel?

This appears as expected in the module browser, putting it into the rack just shows a shadow.

struct RSSkeletonWidget : ModuleWidget {
    RSSkeleton* module;

    RSSkeletonWidget(RSSkeleton *module) {
        this->module = module;

        box.size.x = 100;
        INFO("Racket Science: %f %f", box.size.x, box.size.y);


    void draw(const DrawArgs& args) override {
		nvgStrokeColor(, COLOR_RS_BRONZE);
		nvgFillColor(, COLOR_BLACK);
		nvgStrokeWidth(, 1.5);

		nvgRoundedRect(, box.pos.x, box.pos.y, box.size.x, box.size.y, 5);

You need to call the superclass draw method in the overridden method.

Like this?


Makes no difference.

Did you put it at the end of your draw() method?

Tried at both beginning and end, same (lack of) result.

Seems your module has height of 0 or do I miss something?

Height (as reported by INFO) is 380.

Rack autoadjusts the height based on the width.

You are drawing your rectangle at the wrong position, if you want it to fill your whole module GUI :

nvgRoundedRect(, 0, 0, box.size.x, box.size.y, 5);

Ah right, ModuleWidget::box.pos is the relative position in the parent widget.


Thank you :slight_smile: