Search This Blog

Thursday, December 23, 2010

Python GTK "Getting started" tutorial problem

Programmer Question

Hello everybody!
I have a problem with compiling a basic and really simple example of PyGTK usage listed on pygtk's website.



This is the first example from this site:
http://www.pygtk.org/pygtk2tutorial/ch-GettingStarted.html



My code looks like this:



#!/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'm getting the following error:




gtk
main
Traceback (most recent call last):
File "gtk.py", line 19, in
base = Base()
File "gtk.py", line 11, in init
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
AttributeError: 'module' object has no attribute 'Window'




I've found an info somewhere that it shpuld be fixed by installing PyGTK from source. I did it but it changed nothing. The message is still the same.



I'm using ubuntu 10.10



Have you any ideas on what can be wrong ?
Thanks for any help!



Mike



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails