[Tutor] cannot subclass imported type

spir denis.spir at free.fr
Wed May 13 17:32:13 CEST 2009


Hello,

I wanted to subclass the type Window of pyGTK for main app windows (for the obvious reason that they always contain the same init and end code) and run into an unexpected problem:
=============================
import pygtk
pygtk.require('2.0')
import gtk
# debug output
print gtk
print gtk.Window

# app window
class WApp(gkt.Window):
    <some code>
=============================
==>
=============================
<module 'gtk' from '/var/lib/python-support/python2.5/gtk-2.0/gtk/__init__.pyc'>
<type 'gtk.Window'>
Traceback (most recent call last):
  File "appWindow.py", line 11, in <module>
    class WApp(gkt.Window):
NameError: name 'gkt' is not defined
=============================

???
Someone could explain?

Denis
------
la vita e estrany


More information about the Tutor mailing list