10 Feb 16:58
Display of values within object
Hi,
I have a view defined in a Controller class. On this view, I would like to display two integers: one from
my_model, and one from an instance of an object residing in my_model.
The code below demonstrates what I am trying to achieve, except that Item('baz') currently points to an
instance of an object, rather than the integer residing within the instance.
I thought that a dot notation might work here, as in: Item('baz.foo'), but no such luck.
This is just a simplified version of my full application. It would not be useful to put a View() within the
my_object class, as I would like to be able to display different values from my_object in different places
of my UI.
Is there something like baz.foo that I can use?
Thanks for your time.
Regards,
Sam
from traits.api import HasTraits, Int, Instance
from traitsui.api import View, Item, Controller
class my_object(HasTraits):
foo = Int(5)
class my_model(HasTraits):
bar = Int(10)
(Continue reading)
RSS Feed