# Replace scripted module template by scripteddesigner

**URL:** https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736
**Category:** Development
**Created:** [March 18, 2020, 2:46pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736 "2020-03-18T14:46:15Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [March 18, 2020, 2:46pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/1 "2020-03-18T14:46:15Z")

</div>

We have two scripted module templates now: scripted and scripteddesigner. The “scripted” template has several limitations: GUI widgets are created from code, parameter node is not used (user choices are not saved in the scene), logic is not created in the widget (so it is not accessible from other modules).

What do you think about replacing “scripted” template by the new “scripteddesigner” template?

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [March 18, 2020, 3:03pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/2 "2020-03-18T15:03:01Z")

</div>

It would be nice to have just one template that supported both approaches.

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [March 18, 2020, 3:05pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/3 "2020-03-18T15:05:54Z")

</div>

I can certainly add an example in the template that shows how to add a widget using Python code.

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [March 18, 2020, 3:11pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/4 "2020-03-18T15:11:14Z")

</div>

I think it is a good idea to retire the old scripted module template. I don’t see any advantages for using that. Besides, it tends to confuse people at bootcamps, so I imagine that it would confuse any non-expert Slicer developer as well. Better to not have any obsolete options exposed.

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [March 19, 2020, 12:01am UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/5 "2020-03-19T00:01:32Z")

</div>

Pull request submitted:

> <https://github.com/Slicer/Slicer/pull/4744>

---

<div class="post-metadata">

### Author: ![szhang](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@szhang](https://discourse.slicer.org/u/szhang)
#### Post date: [April 28, 2020, 8:45pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/6 "2020-04-28T20:45:26Z")

</div>

Now under Extension Wizards there are all 4 options of scripted, scriptededitoreffect, scriptedsegmenteditoreffect, and scripteddesigner. If scripteddesigner is recommended, is there a tutorial link for this? Thank you.

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 28, 2020, 9:02pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/7 "2020-04-28T21:02:44Z")

</div>

You can find Slicer scripted module development tutorial here: [https://www.slicer.org/wiki/Documentation/Nightly/Training#PerkLab.27s\_Slicer\_bootcamp\_training\_materials](https://www.slicer.org/wiki/Documentation/Nightly/Training#PerkLab.27s_Slicer_bootcamp_training_materials)

---

<div class="post-metadata">

### Author: ![Jack\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jack_zhang/32/16328_2.png) [@Jack\_Zhang](https://discourse.slicer.org/u/Jack_Zhang)
#### Post date: [September 12, 2022, 8:45pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/8 "2022-09-12T20:45:17Z")

</div>

I’m sorry if this is a dumb question but I can’t seem to find the scripteddesigner template. Can someone offer a hand by any chance?

---

<div class="post-metadata">

### Author: ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)
#### Post date: [September 12, 2022, 11:18pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/9 "2022-09-12T23:18:06Z")

</div>

The “scripteddesigner” template has been replaced by just the “scripted” template. There are currently the following module template options when using the Extension Wizard:

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/9/1971d90bb7833e43fed4edc9cb1cb0c22af1d54a.png)

Also see [where-can-i-find-the-extension-templates](https://slicer.readthedocs.io/en/latest/developer_guide/extensions.html#where-can-i-find-the-extension-templates).

---

<div class="post-metadata">

### Author: ![Jack\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jack_zhang/32/16328_2.png) [@Jack\_Zhang](https://discourse.slicer.org/u/Jack_Zhang)
#### Post date: [September 13, 2022, 3:51pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/10 "2022-09-13T15:51:55Z")

</div>

Oh okay thanks. There’s this one section of code that comes with the template that I’d like clarification on:

```auto
uiWidget = slicer.util.loadUI(self.resourcePath('UI/DisplayData.ui'))
self.layout.addWidget(uiWidget)
self.ui = slicer.util.childWidgetVariables(uiWidget)

```

There’s a [tutorial](https://youtu.be/njoTEisxAJ4?t=149) on youtube that doesn’t seem to be using the same template, and doesn’t have three lines of code above. Is the code above required, or is it a place holder that I can replace by writing something similar to what’s shown in the video?

---

<div class="post-metadata">

### Author: ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)
#### Post date: [September 13, 2022, 4:03pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/11 "2022-09-13T16:03:49Z")

</div>

Coding up user interface in python was the old recommendation, but using a UI file which you can manipulate using the Qt Designer is the easier and the current recommendation. The above code that you wrote is the current recommendation so you should continue with that.

---

<div class="post-metadata">

### Author: ![Jack\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jack_zhang/32/16328_2.png) [@Jack\_Zhang](https://discourse.slicer.org/u/Jack_Zhang)
#### Post date: [September 13, 2022, 4:42pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/12 "2022-09-13T16:42:08Z")

</div>

I’m very new to this (this is my second week of using 3D Slicer) so I apologize if these questions sound dumb. I googled Qt Designer and it appears to be a separate program. Do I install this, create a widget app, and then specify the file path where `'UI/DisplayData.ui'` currently is in the first line of the code I pasted above? Do I then need to add a folder named “UI” inside the directory for the module?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [September 15, 2022, 6:11pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/13 "2022-09-15T18:11:51Z")

</div>

For developers convenience, Qt Designer is bundled with Slicer. You can find a Slicer programming tutorial that uses the designer [here](https://github.com/PerkLab/PerkLabBootcamp/blob/master/Doc/day3_2_SlicerProgramming.pptx?raw=true).

---

<div class="post-metadata">

### Author: ![Jack\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jack_zhang/32/16328_2.png) [@Jack\_Zhang](https://discourse.slicer.org/u/Jack_Zhang)
#### Post date: [September 19, 2022, 3:00pm UTC](https://discourse.slicer.org/t/replace-scripted-module-template-by-scripteddesigner/10736/14 "2022-09-19T15:00:51Z")

</div>

Thanks so much! This helps a lot.
