I figured it out I think. hist.gradient.listTicks() returns a list of
tuples with the tick object in the 0 position and (I believe) the position
in the second. So changing the setTickValue line to...
hist.gradient.setTickValue(current_ticks[2][0], 0.7)
runs, and changes the position of the tick on the widget
Thanks for your time, carry on
On Thursday, April 2, 2020 at 4:50:07 PM UTC-6, Jeremy Webster wrote:
>
> Hi
>
> I am trying to programmatically move one of the ticks in the gradient
> editor of a histogramLUT. I tried this...
>
>
> hist = pg.HistogramLUTItem()
> hist.setImageItem(my_image)
> hist.gradient.loadPreset('yellowy')
> current_ticks = hist.gradient.listTicks()
> hist.gradient.setTickValue(current_ticks[2], 0.4)
>
> But I get the error:
>
> File "/Users/myname/directory/plot.py", line 99, in update_images
>> *hist.gradient.setTickValue(current_ticks[2], 0.4)*
>> File
>> "/Users/myname/opt/anaconda3/envs/my_env/lib/python3.6/site-packages/pyqtgraph/graphicsItems/GradientEditorItem.py",
>>
>> line 309, in setTickValue
>> pos = tick.pos()
>> AttributeError: 'tuple' object has no attribute 'pos'
>>
>
> Am I missing something? Or is there a better way to do this?
>
> Thanks
> J
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/c773cbeb-248a-4095-b8b6-f64d310c1cd2%40googlegroups.com.