hrgdavid
Posts: 12
Joined: Thu Jan 05, 2012 10:39 pm

Import Error: No module named pygtk

Sat Jun 30, 2012 8:44 pm

Hi,

I'm new to Python and am presumably making a basic error, but this has had me occupied all afternoon and evening trying to google an answer without success. Please help ;-)

I've copied a simple program from the web to put a window up on the screen. The first line is "Import pygtk". When I run it it returns "Import Error: No module named pygtk".

I've also tried this interactively in LXTerminal - same result. And the same thing happens with "Import gtk".

Do I need to do something first to install these modules ? I thought it was part of the standard Python install....?

Thanks for any help.
Regards,
David L.

andyl
Posts: 265
Joined: Tue Jan 10, 2012 11:05 am

Re: Import Error: No module named pygtk

Sun Jul 01, 2012 8:32 am

You need to install pygtk.

Not every Python module in the world is installed by default.

Code: Select all

sudo apt-get install python-gtk2
You may want to install the doc package too.

hrgdavid
Posts: 12
Joined: Thu Jan 05, 2012 10:39 pm

Re: Import Error: No module named pygtk

Sun Jul 01, 2012 11:06 am

andyl wrote:You need to install pygtk.

Not every Python module in the world is installed by default.

Code: Select all

sudo apt-get install python-gtk2
You may want to install the doc package too.
Andy, you're a star ! Thank you.

kibr3
Posts: 6
Joined: Mon Nov 05, 2012 5:46 am

Re: Import Error: No module named pygtk

Mon Nov 05, 2012 5:53 am

That helped me too .Thanks

sisila
Posts: 1
Joined: Wed Aug 21, 2013 9:16 am

Re: Import Error: No module named pygtk

Wed Aug 21, 2013 9:26 am

thank you........ :o

jander2099
Posts: 1
Joined: Fri Feb 13, 2015 7:47 pm

Re: Import Error: No module named pygtk

Fri Feb 13, 2015 7:50 pm

Yes!!! Thank you so much! That fixed it.

User avatar
paulwratt
Posts: 73
Joined: Fri Jun 12, 2015 12:15 am

Re: Import Error: No module named pygtk

Thu Sep 14, 2017 9:10 am

fix still works (2017)

User avatar
PeterO
Posts: 3631
Joined: Sun Jul 22, 2012 4:14 pm

Re: Import Error: No module named pygtk

Thu Sep 14, 2017 10:23 am

importing PyGTK is the old python interface to Gtk+

You might find this useful for doing it the modern way ! http://www.peteronion.org.uk/PyGobjectGtk+3/PyGtk.html

HTH

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “General programming discussion”

Who is online

Users browsing this forum: No registered users and 6 guests