pygtk beginner script not working

james at imagewebdesign.co.uk james at imagewebdesign.co.uk
Sat Nov 14 20:00:59 EST 2015


Hi guys

I'm new to Python so please bare with me :)

I'm using python 2.7.10 as advised (more tools apparently over 3.x)

Trying to use this script

[CODE]
#!/usr/bin/env python

# example base.py

import pygtk

pygtk.require('2.0')
import gtk

class Base:
   def __init__(self):
      self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
      self.window.show()

def main(self):
   gtk.main()
   
   print __name__
   if __name__ == "__main__":
      base = Base()
      base.main()
[/CODE]

But get this error:

[i]File "C:\Users\CMDEV\Desktop\Py\pygtk_1.py", line 5, in <module>
    import pygtk
ImportError: No module named pygtk[/i]

I've check the install and everything reports its installed right:

Here's a grab of the CLI


[CODE]
C:\Python27>easy_install -U pygtk
Searching for pygtk
Reading https://pypi.python.org/simple/pygtk/
Reading http://ftp.acc.umu.se/pub/gnome/binaries/win32/pygtk/2.24/
Reading http://www.daa.com.au/~james/pygtk/
Reading http://www.daa.com.au/~james/software/pygtk/
Reading http://www.pygtk.org
Reading http://www.pygtk.org/
Best match: pygtk 2.24.0
Processing pygtk-2.24.0-py2.7-win32.egg
pygtk 2.24.0 is already the active version in easy-install.pth
Installing pygtk_postinstall.py script to C:\Python27\Scripts
Installing pygtk_postinstall.pyc script to C:\Python27\Scripts

Using c:\python27\lib\site-packages\pygtk-2.24.0-py2.7-win32.egg
Processing dependencies for pygtk
Finished processing dependencies for pygtk

C:\Python27>python C:\Users\CMDEV\Desktop\Py\pygtk_1.py
Traceback (most recent call last):
  File "C:\Users\CMDEV\Desktop\Py\pygtk_1.py", line 5, in <module>
    import pygtk
ImportError: No module named pygtk
[/CODE]


(not used google groups before to post on so not sure if BB code works here... also there doesn't seem to be a preview button so no idea how this turns out)

Cheers



More information about the Python-list mailing list