Skip to content

Add basic text slider#518

Merged
GuillaumeFavelier merged 6 commits intomasterfrom
add_text_slider_widget
Jan 8, 2020
Merged

Add basic text slider#518
GuillaumeFavelier merged 6 commits intomasterfrom
add_text_slider_widget

Conversation

@GuillaumeFavelier
Copy link
Copy Markdown
Contributor

@GuillaumeFavelier GuillaumeFavelier commented Dec 28, 2019

This PR adds a text slider widget. This is a specialized version of add_slider_widget() for convenience.

import pyvista as pv

data = ['red', 'green', 'blue', 'purple', 'orange']
cone = pv.Cone()


def set_color(color):
    color = pv.parse_color(color)
    cone.point_arrays['color'] = [color] * cone.n_points


p = pv.Plotter()
p.add_text_slider_widget(set_color, data=data, event_type='always')
p.add_mesh(cone, scalars='color', rgba=True)
p.show()

output

This is still a work in progress. I have to:

  • Rework the documentation
  • Update the tests
  • Return the slider

@GuillaumeFavelier GuillaumeFavelier self-assigned this Dec 28, 2019
@GuillaumeFavelier GuillaumeFavelier added the enhancement Changes that enhance the library label Dec 28, 2019
@GuillaumeFavelier
Copy link
Copy Markdown
Contributor Author

This is ready for reviews.

Copy link
Copy Markdown
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me @GuillaumeFavelier. Might be nice to add the Returns to the docstring of add_text_slider_widget, but functionally this PR is great!

@GuillaumeFavelier
Copy link
Copy Markdown
Contributor Author

Thanks for the review, I will add the Returns to the docstring then.

@GuillaumeFavelier GuillaumeFavelier changed the title 🚧 Add basic text slider Add basic text slider Jan 7, 2020
@banesullivan
Copy link
Copy Markdown
Member

@GuillaumeFavelier, feel free to squash and merge when you are ready

@GuillaumeFavelier GuillaumeFavelier merged commit cac5836 into master Jan 8, 2020
@GuillaumeFavelier GuillaumeFavelier deleted the add_text_slider_widget branch January 8, 2020 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Changes that enhance the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants