[Tutor] cannot subclass imported type

Emile van Sebille emile at fenx.com
Wed May 13 17:40:25 CEST 2009


On 5/13/2009 8:32 AM spir said...
> 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
--------GTK

> print gtk.Window
> 
> # app window
> class WApp(gkt.Window):
-------------GKT?


>     <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
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list