0

I am developing a plugin that uses tk package. When I tried to import tk I got an error: ModuleNotFoundError: No module named '_tkinter'. I tried to reinstall tk but it didn't work. I would say that when i used local python tk package works.

1
  • 1
    Try "import tkinter", without underline. But @Dror Bogin is right, you had better to use Qt in your plugin.
    – Zoltan
    Feb 18 at 13:01
3

QGIS uses PyQt for ui, and it doesn't come with a preinstalled Tkinter python package.
I would recommend you either include the relevant package code with your plugin (if the license allows for that),
or use PyQt to build your interface.

I would recommend learning PyQt and using the included Qt Designer as instructed here in the pyqgis developer cookbook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.