Reputation: 23094
Here is a example on the pygtk website:
#!/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()
pygtk is imported but used nowhere, why?
Upvotes: 1
Views: 102
Reputation: 1207
You can find the answer in the FAQs of pygtk: http://faq.pygtk.org/index.py?req=show&file=faq02.004.htp
This import is only necessary if you have installed multiple versions of gtk and want to be sure that the "right" version (the version you want) will be imported. Alternatively the version which you have installed at last will be used.
Upvotes: 2