# VTK with tkinter

**URL:** https://discourse.vtk.org/t/vtk-with-tkinter/6738
**Category:** Support
**Created:** [September 30, 2021, 9:45pm UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738 "2021-09-30T21:45:55Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Kamil](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/94ad74/32.png) [@Kamil](https://discourse.vtk.org/u/Kamil)
#### Post date: [September 30, 2021, 9:45pm UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/1 "2021-09-30T21:45:55Z")

</div>

I am trying to combine VTK with tkinter. However I am getting following error.

\_tkinter.TclError: couldn’t load library “vtkRenderingTk-9.0.dll”: this library or a dependent library could not be found in library path

I am trying to load vtkTkRenderWindowInteractor in this way:

from vtkmodules.tk.vtkTkRenderWindowInteractor import vtkTkRenderWindowInteractor

renWinInteract = vtkTkRenderWindowInteractor(root, rw=renWindow, width=400, height=400)

renWinInteract.Initialize()

renWinInteract.pack(side=‘top’, fill=‘both’, expand=1)

renWinInteract.Start()

renWindow.Render()

root.mainloop()

Thanks for any help.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [September 30, 2021, 10:01pm UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/2 "2021-09-30T22:01:50Z")

</div>

The vtkTkRenderWindowInteractor is no longer used nor regularly tested by any of the VTK developers. So unless you really need it you should probably not use it. But if you need it, here is some information about its use.

1. The vtkRenderingTk-9.0.dll is not part of the binary VTK package (not in the package from the vtk website, and not in the pip package either).

2. So if you want to use it, you must first build tcl-8.6.8 and tk8.6.8 from source, and then you must build VTK from source with VTK\_USE\_TK=ON.

3. After the build, find “vtkRenderingTk-9.0.dll” in the bin directory, and move it into Python’s site-packages director.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [September 30, 2021, 10:04pm UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/3 "2021-09-30T22:04:45Z")

</div>

Note that Step 3 might not be necessary. Try it both with, and without this step.

---

<div class="post-metadata">

### Author: ![Kamil](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/94ad74/32.png) [@Kamil](https://discourse.vtk.org/u/Kamil)
#### Post date: [October 1, 2021, 5:40am UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/4 "2021-10-01T05:40:48Z")

</div>

Thank you for your response David. I would rather avoid going through something that is not supported/used anymore. I would like to add some interface to my program such as the buttons. Which is the best way now to do it in python? Build all in VTK with Qt?

Thanks

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [October 1, 2021, 12:17pm UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/5 "2021-10-01T12:17:33Z")

</div>

For Python VTK in Qt, I have an [example of VTK with PySide2](https://gist.github.com/dgobbi/bfdb149e38777f25d0891c1b883858e2). All you need to get started with this example is PySide2 (e.g. installed with pip) and a binary VTK package.

Note that VTK + PyQt and VTK + PySide are not “officially” supported, either, but quite a few people use them and get good results.

---

<div class="post-metadata">

### Author: ![Kamil](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/94ad74/32.png) [@Kamil](https://discourse.vtk.org/u/Kamil)
#### Post date: [October 1, 2021, 12:56pm UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/6 "2021-10-01T12:56:06Z")

</div>

Thank you for your replay. I will have a look at this. However, there is something that is supported with VTK?

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [October 1, 2021, 1:07pm UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/7 "2021-10-01T13:07:30Z")

</div>

There are no GUI toolkits that are officially supported for VTK-Python.

---

<div class="post-metadata">

### Author: ![Kamil](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/94ad74/32.png) [@Kamil](https://discourse.vtk.org/u/Kamil)
#### Post date: [October 1, 2021, 1:08pm UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/8 "2021-10-01T13:08:33Z")

</div>

I understand. Thank you.

---

<div class="post-metadata">

### Author: ![brndon](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/7993a0/32.png) [@brndon](https://discourse.vtk.org/u/brndon)
#### Post date: [December 6, 2024, 1:30am UTC](https://discourse.vtk.org/t/vtk-with-tkinter/6738/9 "2024-12-06T01:30:41Z")

</div>

Another option is [trame](https://kitware.github.io/trame/guide/tutorial/layouts.html) with [pywebview](https://pywebview.flowrl.com).
