GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Aug 25, 2016 8:10 pm

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: gtk Error
PostPosted: Tue Sep 04, 2012 9:07 pm 

Joined: Tue Sep 04, 2012 8:28 pm
Posts: 1
Hey Guys!

Today I programmed some lines of pygtk code. Everything was fine until I tried to rename, resave, or even copy and paste my python-file. When I do that, I get the following error message:

self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
AttributeError: 'module' object has no attribute 'Window'

Only the original file works and I really have NO clue whats wrong about the others.

I trimmed my code to be easier to read - still the same error occurs of course:

import pygtk
import gtk

class Base:
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.button1 = gtk.Button("Exit")
        fixed = gtk.Fixed()

    def close(self,widget,data=None):
        print "Closed"
    def main(self):

if __name__ == "__main__":
    base = Base()

I'm sorry, but I can't tell you what version of PyGTK I really use. I installed PyGTK with PyCairo and PyGObject via a all in one installation from this website:
The version number of the package I used is 2.24.2 which is a 32bit Python 2.7 version.

As mentioned, I especially don't understand why the original version works and the renamed or saved ones not. I allready tried to figure out whats wrong about my code and it seems that this problem is not that uncommon. But the usual problems are:
- typing errors
- the file name is also the name of an imported modul (which is obviously not the case because I named them version1, version2,...)
- wrong versions of PyGTK,... (which to my opinion is also not the case, because the original version works)

I really hope you can help me, I would be very greatful.
Thank's a lot guys!

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group