Writing a composite widget in that sense would be similar to writing a one
in Tkinter.  For the type you propose, you would want to copy across all
the methods of the text widget to the new object, except for ones like
show, hide, realize, unrealize, map, unmap, etc.  Maye sure you do not
overwrite the _o attribute of the container widget, since this is used
when packing the widget.  So you would use something like this:
  class ScrolledText(GtkScrolledWindow):
        def __init__(self):
                GtkScrolledWindow.__init__(self)
                self.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
                text = GtkText()
                self.add(text)
                text.show()
                # now copy accross the text widget's methods

For some examples of composite widgets that do not involve copying across
methods, see some of the examples in the examples/ide directory.

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Tue, 6 Jul 1999, Fred L. Drake wrote:

> 
>   I've been playing with pygtk off & on for a while, & am interested
> in creating some helper classes.  I have a question about how
> composite widgets should fit into the class hierarchy.
>   If I want to create a "scolled-text" widget, I'd like it essentially 
> act like a text widget.  Until, of course, I actually go and pack it,
> add it to a frame, or whatever, at which point I want it to look like
> the table widget that I've actually composed it with.
>   I'm just using the gtk module; no GNOME or alternate interfaces.
>   How have others approached this?
>   (Is anyone working on getting the text widget to support horizontal
> scrolling and be well-supported with the ScrolledWindow widget?)
>   Thanks!
> 
> 
>   -Fred
> 
> --
> Fred L. Drake, Jr. <[EMAIL PROTECTED]>
> Corporation for National Research Initiatives
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> 

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to