# Size of buttons in user interface

**URL:** <https://discourse.slicer.org/t/size-of-buttons-in-user-interface/12098>\
**Category:** Support\
**Created:** [June 18, 2020, 4:29pm UTC](https://discourse.slicer.org/t/size-of-buttons-in-user-interface/12098 "2020-06-18T16:29:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ada](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ada/32/15944_2.png) [@ada](https://discourse.slicer.org/u/ada)\
**Post date:** [June 18, 2020, 4:29pm UTC](https://discourse.slicer.org/t/size-of-buttons-in-user-interface/12098/1 "2020-06-18T16:29:48Z")

</div>

Hello all,

I am writing my own custom module in python but I have some problem to create a custom user interface.  
I have some (basic) questions about it:

- Is it possible to define the size (width and height) of a QPushButton ?
- How can I set several buttons side by side in a same row ?
- How can I display an icon/logo into a QPushButton ?

Is it possible to do all these things without using Qt Designer? only with basic python code?

Thank you for your help,  
Best

---

<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:** [June 18, 2020, 5:33pm UTC](https://discourse.slicer.org/t/size-of-buttons-in-user-interface/12098/2 "2020-06-18T17:33:27Z")

</div>

Yes, all this is possible with python. Best thing to do is read through the related [Qt documentation](https://doc.qt.io/) - for the most part the entire public API is available through python in slicer with just small syntax differences from the C++ examples. Also you can look at the python code in any [scripted modules](https://github.com/Slicer/Slicer/tree/master/Modules/Scripted) and copy any patterns for interfaces you like.

---

<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:** [June 20, 2020, 9:48pm UTC](https://discourse.slicer.org/t/size-of-buttons-in-user-interface/12098/3 "2020-06-20T21:48:02Z")

</div>

Here is an example of a module (not a simple one, but still may be useful) that uses style sheets that make buttons and other widgets larger so that Slicer can be used on a touch-screen tablet: [https://github.com/PerkLab/CentralLineTutor/tree/master/CentralLineTutor](https://github.com/PerkLab/CentralLineTutor/tree/master/CentralLineTutor)

---

<div class="post-metadata">

**Author:** ![ada](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ada/32/15944_2.png) [@ada](https://discourse.slicer.org/u/ada)\
**Post date:** [June 22, 2020, 8:22am UTC](https://discourse.slicer.org/t/size-of-buttons-in-user-interface/12098/4 "2020-06-22T08:22:17Z")

</div>

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [May 29, 2021, 10:13pm UTC](https://discourse.slicer.org/t/size-of-buttons-in-user-interface/12098/5 "2021-05-29T22:13:17Z")

</div>

I’m interested in examples of GUI customized for touch-screen applications. Are there any examples available? (The link you posted earlier is not working)

---

<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:** [May 30, 2021, 12:42am UTC](https://discourse.slicer.org/t/size-of-buttons-in-user-interface/12098/6 "2021-05-30T00:42:52Z")

</div>

That repository seems to be private, but this one is public: [GitHub - SlicerIGT/LumpNav: Slicer extension for ultrasound-guided breast tumor resection (lumpectomy)](https://github.com/SlicerIGT/LumpNav)
