jasongrout/simple-python-db-compute — Issue #210: Interact variable names w/layouts
Author: kramer314
Created: 2011-10-29 21:14:01+00:00
State: open

The layout() parameter seems to have issues with variable names longer than 1 character. This works:

```python
@interact(layout = {"top_right": ["n"], "bottom_left": ["p"]})
def f(n = ContinuousSlider(), p = ContinuousSlider()):
print n + p

```

This doesn't:

```python

@interact(layout = {"top_right": ["name"], "bottom_left": ["p"]})
def f(name = ContinuousSlider(), p = ContinuousSlider()):
print n + p

```

The error that occurs suggests it shouldn't be hard to fix - the problem is that in checking whether layout variables are defined the variables are being split up into individual characters.

```

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/tmp/tmp_T8MpA/ in ()

/padic/scratch/jason/simple-python-db-compute/interact_singlecell.py in _(f)
132 def _(f):
--> 133 return func(f, *args, **kwargs)
134 return _

/padic/scratch/jason/simple-python-db-compute/interact_singlecell.py in interact(f, controls, update, layout)
240 elif set(flatten(value))-nameset:
--> 241 raise ValueError("Layout variables %s are not interact variables."%repr(list(set(flatten(value))-nameset)))
242 sanitized_layout[key] = value

ValueError: Layout variables ['a', 'm', 'e', 'n'] are not interact variables.

```