<div dir="ltr">Well, here are some clues - the "multiple" inheritance doesn't seem to work the way the manual *implies* it should i.e. multiple inheritance is described as searching for methods in the first inheritance and then all it's ancestors, then onto the next and all its ancestors and so on.<br>
<br>To get an "insert" (Listbox) method on your class you need to invoke the __init__ method on the super classes (sub-classes should always invoke the initialisation of their super class anyway - so that is something your class definition is definitely missing!) i.e.<br>
<br> Listbox.__init__(self)<br><br>If you do just this, then ScrolledList has the Listbox attributes (and none of the others). If you then add initialisation of Scrollbar then you have this:<br><br> Listbox.__init__(self)<br>
Scrollbar.__init__(self)<br><br>And viola! ScrolledList now has the methods of Scrollbar - and "lost" the methods of Listbox.<br><br>So without being any kind of expert on Tk objects with inheritance etc it looks very much as though you have attempted too simplistic an approach to creating what amounts to a "composite" object.<br>
<br>I would suggest that you pick one of your 3 objects to do the real inheritance - and then create actual methods on ScrolledList that "duplicate" the methods of the other object methods. That is the only way I can see you get this working at the moment.<br>
<br>Hope this helps<br>Peter<br><br><div class="gmail_quote">On Wed, Aug 6, 2008 at 6:23 PM, vtcodger <span dir="ltr"><<a href="mailto:donaldkenney@gmail.com">donaldkenney@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Ron -- Thanks, I thought I was doing about what you describe, but apparently<br>
not as the tk attribute for the class objects is not getting set up. I'm a<br>
bit hazy on what the tk attribute does (other than making things work) and<br>
can't find much about it via Google. I'll go back and subclass from frame<br>
rather than trying to multiply inherit from Frame, List, and Scrollbar.<br>
<br>
Peter -- Thanks also. I was aware of the PMW scrolledlist. And it works<br>
fine. But I don't want to use any components that are not part of the<br>
standard Python distribution. Should have mentioned that, but the post was<br>
getting overlong.<br>
<br>
===<br>
<br>
As a practical matter, I discovered after I posted, that I can access my<br>
frame, list (and probably scrollbar as well) methods from the main program<br>
via their objects. That is to say that the way I did it, a scrolled list<br>
object sl doesn't have a directly usable grid or insert method, but<br>
sl.f.grid(... or sl.l.insert seem to work fine.<br>
<br>
What bothers me, isn't that I can't get things to work. It's that I clearly<br>
don't understand what is going on.<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/Creating-a-new-widget-class-tp18802754p18846448.html" target="_blank">http://www.nabble.com/Creating-a-new-widget-class-tp18802754p18846448.html</a><br>
</font><div><div></div><div class="Wj3C7c">Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
Tkinter-discuss mailing list<br>
<a href="mailto:Tkinter-discuss@python.org">Tkinter-discuss@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tkinter-discuss" target="_blank">http://mail.python.org/mailman/listinfo/tkinter-discuss</a><br>
</div></div></blockquote></div><br></div>