title: using a method trait in a traitsui factory
body: <p>I am trying to figure out how <code>Method</code> traits work and if I can use one in a factory defined in a traits View object in order to have dynamic values passed to the factory.</p>
  
  <p>Here is what I mean, a minimal test case which works except for the factory behavior (it runs, but using the factory will cause a crash):</p>
  
  <pre><code>from traits.api import HasTraits, Method, Str, List, Instance, method, Int, Any
  from traitsui.api import View, Item, TableEditor, ObjectColumn, TextEditor
  
  class Dog(HasTraits):
      name = Str('Fido')
      value = Int(5)
  
  class DogTable(HasTraits):
  
      def factory(self):
          return Dog(value=self.current_user_value)    
  
      dog_factory = Method(factory)
  
      dogs = List(Instance(Dog))
      current_user_value = Int(3)
  
      def _dogs_default(self):
          return [
              Dog(name='Joe', value=6),
              Dog(name='Ted', value=2),
          ]
  
      traits_view = View(
          Item('dogs',
              editor=TableEditor( columns =
                  [
                  ObjectColumn(label='name', editor=TextEditor(), name='name'),
                  ObjectColumn(label='value', editor=TextEditor(), name='value'),
                  ],
                 row_factory = dog_factory,
              )
          ),
          Item('current_user_value'),
          height=300, width=300,
      )
  
  DogTable().configure_traits()
  </code></pre>
  
  <p>So what I am trying to do here is set up the factory so that the user can add new items to the table which contain as an initial <code>value</code> whatever value is currently specified by the user in the GUI.</p>
  
  <p>Is there some way to do this? I thought that using a <code>Method</code> trait would resolve this problem by referring to the bound method and allow me to actually call the bound method in this instance, but it seems like <code>Method</code>'s semantics are no different from <code>Callable</code>. And I can't figure out any way to supply arguments to the factory dynamically, other possibly than by hacky use of <code>eval</code> or global variables (<code>factory_row_args</code> rejects dynamic arguments).</p>