# Creating a toolbar in Python

**URL:** <https://discourse.slicer.org/t/creating-a-toolbar-in-python/965>\
**Category:** Development\
**Created:** [August 29, 2017, 1:58pm UTC](https://discourse.slicer.org/t/creating-a-toolbar-in-python/965 "2017-08-29T13:58:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![moselhy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/moselhy/32/501_2.png) [@moselhy](https://discourse.slicer.org/u/moselhy)\
**Post date:** [August 29, 2017, 1:58pm UTC](https://discourse.slicer.org/t/creating-a-toolbar-in-python/965/1 "2017-08-29T13:58:34Z")

</div>

Hello,

I was wondering whether it would be possible to create a toolbar widget using Python, without the need of C++. Similar to this layout:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/2/b2a74998c8e9f52475960695b1a41f13d53af532.png)

Thanks

---

<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:** [August 29, 2017, 3:18pm UTC](https://discourse.slicer.org/t/creating-a-toolbar-in-python/965/2 "2017-08-29T15:18:21Z")

</div>

You can create a toolbar in Python the same way as in C++:

- [create QToolBar](https://github.com/SlicerRt/Sequences/blob/00d4b4d98f340cd45f48ec00661ae717720d40f5/SequenceBrowser/qSlicerSequenceBrowserModule.cxx#L69-L72)
- [add actions or widgets into it](http://doc.qt.io/qt-4.8/qtoolbar.html#addWidget)
- [add it to the main window](https://github.com/SlicerRt/Sequences/blob/00d4b4d98f340cd45f48ec00661ae717720d40f5/SequenceBrowser/qSlicerSequenceBrowserModule.cxx#L89)
