Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from trame.widgets import vtk is not user friendly and should not be in the examples #127

Closed
banesullivan opened this issue Sep 29, 2022 · 4 comments

Comments

@banesullivan
Copy link

Is your feature request related to a problem? Please describe.

The vtk widgets module should be named something else as only serious VTK power users import vtk-python the proper way like from vtkmodules.vtkRenderingCore import vtkRenderWindow.

Most (like 99% of) users simply use import vtk and that's not going anywhere. Having from trame.widgets import vtk in the examples where you want users to also use VTK-python is setting new users up for failure as the two namespaces will conflict.

Further, VTK is an overwhelming library for new users, so seeing from trame.widgets import vtk, they will likely think that vtk is the actual vtk where they can get classes like vtkPolyData (actually even I thought that when first trying trame).

Describe the solution you'd like

The vtk widgets module should be named something other than vtk, like vtk_widgets

from trame.widgets import vtk should be something else, perhaps from trame.widgets import vtk_widgets

Describe alternatives you've considered

An alternative is to have all the examples use an alias: from trame.widgets import vtk as vtk_widgets

Additional context

I'm having to carefully modify this import statement in every trame app I create from the examples (I use the examples as templates which I expect most others do as well)

@jourdain
Copy link
Collaborator

I will be fine doing from trame.widgets import vtk as vtk_widgets in all examples as I would not like the redundancy of widgets be forced on everyone.

In other word, that would means that every trame.widgets.* would need to be prefixed with widgets_*. Think plotly, matplotlib, leaflet and more...

@jourdain
Copy link
Collaborator

jourdain commented Sep 29, 2022

Also a side note, I usually encourage people to do the vtk import as follow when they don't want to deal with vtkmodules.

from vtk import (
  vtkPolyData,
  vtkActor, 
  vtkMapper,
)

But I get that namespace can obviously conflict. But in real application the UI tend to be in a different file where no vtk/C++ is involved.

@jourdain
Copy link
Collaborator

So should we update the examples?

@banesullivan
Copy link
Author

I will be fine doing from trame.widgets import vtk as vtk_widgets in all examples

Let's do this in the examples with VTK then

In other word, that would means that every trame.widgets.* would need to be prefixed with widgets_*. Think plotly, matplotlib, leaflet and more...

yeah... I too do not want to add a *_widgets suffix to each module so perhaps just aliasing the VTK one makes the most sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants