Modifying cell contents with python expression

Hi! Hope ya all are having a great day, I need your advice again.
I have a cell which looks like this

and I’d like to modify its contents with a python expression so that it points to different operators, for instance, swap that /final for /bg.

And another thing, regarding scrollability of that numeric field which I’d like to avoid.

model1.tox (2.0 KB)
How do I do that?

The syntax for modifying the contents of a cell is -
op('yourTargetDAT')['targetRow', 'targetCol'] = theValYoureSending

There are a number of ways to approach this - for example, both of these approaches work:

In the attached example right click and select run on the text DATs to see the table DAT change.

change-cell.tox (534 Bytes)

Re: the scrolling - you might consider using a widget or field COMP instead of the parameter COMP for this UI element. Widgets especially should be more flexible and allow you to have the interaction you’re after without this behavior.

Widgets are cpu-heavy to replicate, that’s the reason why I’m using that Parameter comp.

Sorry, I didn’t make it clear :frowning: I’m not after modifying the cell contents inside the table, instead I need to read it, modify it and then reference it to an operator.
Like this (was told to do so by a kind person on discord)

op(‘myop’).par.mypar = op(op(‘data’)[1, ‘path’]).parent()

this just removes /final so I’m getting /project1/graphics/pillar_tunnel
How do I get
out of that particular cell without modifying the table itself? Actually these two lines are all that’s left, but understanding the whole principe would be awesome.

ahh - python’s replace() method should get you there:


If you want to keep using the parameter COMP, it looks like you’ve expanded your expression:


clicking that - sign will collapse your parameter and only result in a small wiggle scroll. Not perfect, but closer without major changes.


Awesome and easy) Lots of thanks! Is there a limit per capita for stupid questions, like this one, here? :sweat_smile:

ha! never - we all get stuck sometimes. :slight_smile:

1 Like