[pygtk] glade custom widgets

Darryl Ross darrylross@optushome.com.au
Thu, 2 Nov 2000 09:07:09 +1100


Hi,

I'm trying to use a custom widget with glabe but it gives me the
following error:

** WARNING **: could not find widget creation function

Doe anyone know how to use glade custom widgets with python-gtk/gnome?

Here is my simple test script, where db_edit is what I put for the 
creation function in glade:

from gtk import * 
from gnome.ui import *
import libglade

class DBEdit(GtkEntry):
	def __init__(self):
		GtkEntry.__init__(self)

class App:
	"""
	The gui.
	"""
   	def __init__ (self):
        	self.wtree = libglade.GladeXML ('cookbook.glade')
		self.wtree.get_widget ('cookbook').connect ("destroy", mainquit)
		dict = {}
		for key in dir (self.__class__):
			dict[key] = getattr (self, key)
		self.wtree.signal_autoconnect (dict)
	def quit (self, *args):
		mainquit()
	def db_edit (self, name, s1, s2, int1, int2):
		widget = DBEdit ()
		return widget

if __name__ == '__main__':
    	app = App()
        mainloop()

tia,

Darryl