Use of subpanel

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of subpanel

Hoogendoorn, Eelco

What im seeking to do is to display a bunch of interacting HasTraits objects in a single window, where I define the look of each object within the object itself. It is my understanding that I need to use subpanel to accomplish this, but I am unable to find any meaningful documentation on the subject.

Generally, I much prefer to learn from examples rather than abstract class definitions, but the examples that ive found are rather scattered, and I cant find any that adress this particular topic. If there is a large collection of exmaples that ive missed, id very much appreciate any pointers.

Regards,
Eelco Hoogendoorn
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Use of subpanel

Jake Ross
This was something I wasnt sure about either when first starting. The trick I have found is to use the Instance
trait and custom style.


example

class A(HasTraits):
        name=Str
class B(HasTraits):
        x=Int

class C(HasTraits)
        ka=Instance(A, ())
        kx=Instance(B, ())
       
        v=View(Item('ka', style='custom'),
                        Item('kx', style='custom'))





On Jun 13, 2011, at 5:56 AM, Hoogendoorn, Eelco wrote:

>
> What im seeking to do is to display a bunch of interacting HasTraits objects in a single window, where I define the look of each object within the object itself. It is my understanding that I need to use subpanel to accomplish this, but I am unable to find any meaningful documentation on the subject.
>
> Generally, I much prefer to learn from examples rather than abstract class definitions, but the examples that ive found are rather scattered, and I cant find any that adress this particular topic. If there is a large collection of exmaples that ive missed, id very much appreciate any pointers.
>
> Regards,
> Eelco Hoogendoorn
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Use of subpanel

Jonathan March
To add to Jake's comment, typically it will be most useful to define an
explicit View within each of class A and B.

Another advantage of nested views like this is that it gives you more
control over panel sizing -- you can explicitly size Items (though this
parameter will not always be heeded) and Views, but not (at present) Groups.

-- Jonathan

On Mon, Jun 13, 2011 at 8:30 AM, Jake Ross <[hidden email]> wrote:

> This was something I wasnt sure about either when first starting. The trick
> I have found is to use the Instance
> trait and custom style.
>
>
> example
>
> class A(HasTraits):
>        name=Str
> class B(HasTraits):
>        x=Int
>
> class C(HasTraits)
>        ka=Instance(A, ())
>        kx=Instance(B, ())
>
>        v=View(Item('ka', style='custom'),
>                        Item('kx', style='custom'))
>
>
>
>
>
> On Jun 13, 2011, at 5:56 AM, Hoogendoorn, Eelco wrote:
>
> >
> > What im seeking to do is to display a bunch of interacting HasTraits
> objects in a single window, where I define the look of each object within
> the object itself. It is my understanding that I need to use subpanel to
> accomplish this, but I am unable to find any meaningful documentation on the
> subject.
> >
> > Generally, I much prefer to learn from examples rather than abstract
> class definitions, but the examples that ive found are rather scattered, and
> I cant find any that adress this particular topic. If there is a large
> collection of exmaples that ive missed, id very much appreciate any
> pointers.
> >
> > Regards,
> > Eelco Hoogendoorn
> > _______________________________________________
> > Enthought-Dev mailing list
> > [hidden email]
> > https://mail.enthought.com/mailman/listinfo/enthought-dev
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev