# Need some guidance to make a colour sampler plugin

**URL:** <https://krita-artists.org/t/need-some-guidance-to-make-a-colour-sampler-plugin/97571>\
**Category:** Developer Questions\
**Created:** [July 26, 2024, 2:30am UTC](https://krita-artists.org/t/need-some-guidance-to-make-a-colour-sampler-plugin/97571 "2024-07-26T02:30:25Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Lucifer](https://krita-artists.org/letter_avatar_proxy/v4/letter/l/ad7895/32.png) [@Lucifer](https://krita-artists.org/u/Lucifer)\
**Post date:** [July 26, 2024, 8:59am UTC](https://krita-artists.org/t/need-some-guidance-to-make-a-colour-sampler-plugin/97571/6 "2024-07-26T08:59:44Z")

</div>

Here’s an excerpt of my [plugin’s](https://krita-artists.org/t/ten-brush-slots/74805) code to get the brush tool button.

```auto
from PyQt5.QtWidgets import QDockWidget, QToolButton

def loadTool(self):
        toolBox = Application.activeWindow().qwindow().findChild(QDockWidget, 'ToolBox')
        self.brushTool = toolBox.findChild(QToolButton, 'KritaShape/KisToolBrush')

```

The buttons are [QToolButton](https://doc.qt.io/qt-6/qtoolbutton.html) class so you can use isChecked() or pressed() etc depending on your needs.

To find the names of the tool button objects for use with toolBox.findChild(), you can paste this onto the scripter and run it.

```auto
from PyQt5.QtWidgets import QDockWidget, QToolButton

toolBox = Application.activeWindow().qwindow().findChild(QDockWidget, 'ToolBox')
buttons = toolBox.findChildren(QToolButton)
for button in buttons:
  print(button.objectName())

```

I forgotten which plugin I learned this from, may be [Buli Brush Switch](https://krita-artists.org/t/buli-brush-switch/32677)? But you can always research the available plugins to see how others implement a similar function.

---

_[View the full topic](https://krita-artists.org/t/need-some-guidance-to-make-a-colour-sampler-plugin/97571)._
