pygtk and object consistency



Can anyone explain to me why the objects in my program are not consistent?
The output follows:

Testing module.
Class initialized.
a
<gtk.GtkEntry instance at 812a980>  ==  <gtk.GtkEntry instance at 813c3e8>
ab
<gtk.GtkEntry instance at 80cc448>  ==  <gtk.GtkEntry instance at 813c3e8>
abc
<gtk.GtkEntry instance at 8129ac8>  ==  <gtk.GtkEntry instance at 813c3e8>
quit
<gtk.GtkEntry instance at 810c0f0>  ==  <gtk.GtkEntry instance at 813c3e8>


The code is below.  There is only one GtkEntry in my program, yet I have
all sorts of different instances listed in the output.  Why is there not
only one?

Code:

#! /usr/bin/env python

from gtk import *

class Channel:

    def entry(self, e):
        print e.get_text()
        print `e` + "  ==  " + `self.input`
        if e.get_text() == 'quit':
            mainquit()
    
    def __init__(self):
        self.window = GtkWindow(WINDOW_TOPLEVEL)
        self.input = GtkEntry()
        self.input.connect("activate", self.entry)
        self.window.add(self.input)
        self.input.show()
        self.window.show()
        
        print "Class initialized."


# end of class definitions
    
def selftest():
    print "Testing module."
    channel = Channel()
    mainloop()


if __name__ == "__main__":
    selftest()

# end


        



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]