# Creating a model combo box

**URL:** https://discourse.slicer.org/t/creating-a-model-combo-box/9582
**Category:** Development
**Created:** [December 22, 2019, 1:25am UTC](https://discourse.slicer.org/t/creating-a-model-combo-box/9582 "2019-12-22T01:25:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![talmazov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/talmazov/32/3966_2.png) [@talmazov](https://discourse.slicer.org/u/talmazov)
#### Post date: [December 22, 2019, 1:25am UTC](https://discourse.slicer.org/t/creating-a-model-combo-box/9582/1 "2019-12-22T01:25:52Z")

</div>

Hey all,  
I tried to create a combo box that will list mesh models, which i know fall under the general classification of ModelNode class, like this

> modelNodeSelector = slicer.qMRMLNodeComboBox()  
> modelNodeSelector.objectName = ‘modelNodeSelector’  
> modelNodeSelector.toolTip = “Select a model.”  
> modelNodeSelector.nodeTypes = [‘vtkMRMLModelNode’]  
> modelNodeSelector.noneEnabled = True  
> modelNodeSelector.addEnabled = True  
> modelNodeSelector.removeEnabled = True  
> self.pathFormLayout.addRow(“Input Model:”, modelNodeSelector)  
> self.parent.connect(‘mrmlSceneChanged(vtkMRMLScene\*)’, modelNodeSelector, ‘setMRMLScene(vtkMRMLScene\*)’)

however the UI is grayed out and i cannot select anything. i suspect it has something to do with specifying the nodeTypes but im not sure. I have imported an STL model into the scene and it is visible in the Models viewer.

---

<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: [December 22, 2019, 2:18am UTC](https://discourse.slicer.org/t/creating-a-model-combo-box/9582/2 "2019-12-22T02:18:08Z")

</div>

You need to set the MRML scene. I’m not sure that the parent connection that you are trying to use to set the scene is working. In scripted modules we usually set the scene using set method instead.

Note that manual widget creation is not recommended since you can now use a visual editor (Qt Designer) that is bundled with Slicer. It results in much less code, nicer look, with less development effort. See detailed 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)
