I had a problem compiling a simple and simple example of using PyGTK on a pygtk site.
This is the first example from this site: http://www.pygtk.org/pygtk2tutorial/ch-GettingStarted.html
My code is as follows:
#!/usr/bin/env python # example gtk.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()
And after calling python gtk.py, I get the following error:
GTK Main Traceback (last last call): File "gtk.py", line 19, in base = Base () File "gtk.py", line 11, in init self.window = gtk.Window (gtk.WINDOW_TOPLEVEL) AttributeError : the 'module' object does not have the 'Window' attribute
I found information somewhere that it can be fixed by installing PyGTK from the source. I did it, but didnโt change anything. The message remains the same.
I am using ubuntu 10.10
Do you have any idea what might be wrong? Thanks for any help!
Mike
source share