sliders with multiple windows #527
-
Hello It is the follow-up of my previous : question. I want the slider 'on top' of the two windows like in this sketch. How to do that ? Thank you again for the fasts answers and the great support you always give ! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
It's theoretically possible but you need to create a subwindow (renderer) just to host the slider.. otherwise you will have in one of the two. Check out the example: and for the creation of an overlapping renderer: |
Beta Was this translation helpful? Give feedback.
-
Hi Anton, sorry for the late reply, I need to look at how things can be improved on this because indeed it's confusing.. |
Beta Was this translation helpful? Give feedback.
-
BTW this could be a solution with multiple renderers: from vedo import *
settings.immediateRendering = False # faster for multi-renderers
# (0,0) is the bottom-left corner of the window, (1,1) the top-right
# the order in the list defines the priority when overlapping
custom_shape = [
dict(bottomleft=(0.0, 0.0), topright=(0.5, 1), bg="wheat", bg2="w"), # ren0
dict(bottomleft=(0.5, 0.0), topright=(1, 1), bg="blue3", bg2="lb"), # ren1
dict(bottomleft=(0.2, 0.05), topright=(0.8, 0.1), bg="white"), # ren2
]
plt = Plotter(shape=custom_shape, size=(1600, 900))
s0 = ParametricShape(0)
s1 = ParametricShape(1)
plt.show(s0, "renderer0", at=0)
plt.show(s1, "renderer1", at=1)
def slider1(widget, event):
value = sliderRep.GetValue()
s0.rotateY(value)
s1.rotateY(-value)
plt.renderer = plt.renderers[2] # make it the current renderer
slider = plt.addSlider2D(slider1, -5, 5, value=0, pos=([0.05, 0.02], [0.55, 0.02]))
sliderRep = slider.GetRepresentation()
vscale = 20
sliderRep.SetSliderLength(0.003 * vscale) # make it thicker
sliderRep.SetSliderWidth(0.025 * vscale)
sliderRep.SetEndCapLength(0.001 * vscale)
sliderRep.SetEndCapWidth(0.025 * vscale)
sliderRep.SetTubeWidth(0.0075 * vscale)
interactive().close() which makes me realize that I could again improve on clarity on various things :) |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for these responses! They were very helpful. I can't get the value on the slider to display. It is too small and there doesn't seem to be a parameter that changes this. Any ideas? |
Beta Was this translation helpful? Give feedback.
Hi Anton, sorry for the late reply, I need to look at how things can be improved on this because indeed it's confusing..
the
plt.show(at=0)
is perfectly fine, maybe one can replace it withplt.renderer = plt.renderers[0]
to make the first renderer the "current" renderer (I haven't tested it!).