Updating list in Parameter Tree

45 views
Skip to first unread message

Omar

unread,
Mar 29, 2017, 2:38:16 PM3/29/17
to pyqtgraph
Hi all,

I am using pyqtgraph and I really like it. I have a small problem: I have a parameter tree that needs to be modified depending  on user's selection of a combo box

 
I have this:

par={ {'name': 'db type', 'type':'list','values': ['server','serverless']},{'name': 'CHAN', 'type':'list','values': ['--']}
p = Parameter.create(name='params', type='group', children=par)


if the users select 'server' or 'serverless':

I would like something like this:

if p.child('db type').value()=='server':
     p.child('CHAN').values=['1','2',''3]
else:
     p.child('CHAN').values=['A','B',''C]

so now the user would see the  combo box 'CHAN' with options 1,2,3 or A,B,C. but I cannot find a way to modify the list elements.

I am sure I am missing something but I am stuck with this problem. 

Any feedback is appreciated

Omar

Sebastian Höfer

unread,
Mar 30, 2017, 11:11:38 AM3/30/17
to pyqtgraph
Hi Omar,

it's a bit confusing, because internally the 'ListParameter' class apppears to handle the 'values' with the 'limits' parameter. No guarantees, but this should work:

p.param( 'db type').setLimits(['1', '2', '3'])


Cheers
Sebastian

Omar

unread,
Mar 30, 2017, 11:23:18 AM3/30/17
to pyqtgraph
Sebastian,

that did the trick. Thank you

Omar
Reply all
Reply to author
Forward
0 new messages