0

I want to make a GTK+2 or GTK+3 application in Python 3.

For GTK+2, I tried installing PyGTK, but I cannot find any version of PyGTK for Python 3 within Debian's repositories.

For GTK+2, I followed the tutorials in the Python Gtk+3 Tutorial. I installed python3-gi, but when I type python3 in the terminal, then type from gi.repository import Gtk, it reports this:

ImportError: cannot import name Gtk

How can I install GTK+2 or GTK+3 for use with Python 3 on Debian?

  • What do you consider "the Python 3 IDE"? – Anthon Dec 16 '14 at 11:36
  • Oh, maybe the word is not "IDE", but "IDLE" or some similar name, run by typing python3 in a terminal window. – Village Dec 16 '14 at 11:37
  • I cannot reproduce this under Linux Mint 17.1 (i.e. Gtk can be imported). Did you start idle3 and not idle? (I asked about the IDE as there are multiple and I only had WingIDE installed, not idle3). – Anthon Dec 16 '14 at 11:43
  • I just opened a terminal, typed python3, confirmed it is version 3, then typed out from gi.repository import Gtk, and pressed enter. I also tried saving some of the example files from that tutorial I linked, but they reported the same error that Gtk was not found. I search Debian's repositories, but cannot determine which package might contain the Gtk needed by Python. – Village Dec 16 '14 at 11:48
  • Is /usr/lib/python3/dist-packages in your sys.path? ( python3 -c "import sys; print(sys.path)" ) The gi directory should be there ( ls /usr/lib/python3/dist-packages/gi) – Anthon Dec 16 '14 at 11:57

Your Answer

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

Browse other questions tagged or ask your own question.