What can I do to set a button on the page that controls the passing of parameters in the writing function, which affects the display of the image
If you want to edit the opacity function, check out the PiecewiseGaussianWidget.
Can I rewrite this js example in python? Does python vtk have a similar widget？
vtk-python has no similar widget, so you would have to rewrite it there.
Thank you for your answer. This clarified my next thinking direction.