enthought / enthought/mayavi

SceneModel get_size function not returning correct value with pyqt5

Open
#854 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

I found out that the SceneModel (from tvtk.pyface.scene_model) class function
.get_size() is half as big when using pyqt5. The minimal example below; just click the “create_arrow” button and it should be placing the text in the middle of the scene view:

```
from traits.api import Button, HasStrictTraits, Instance, Int

from traitsui.api import UItem, View

from tvtk.api import tvtk
from tvtk.pyface.scene_editor import SceneEditor
from tvtk.pyface.scene_model import SceneModel


class TestSceneViewer(HasStrictTraits):

test_scene = Instance(SceneModel)

create_arrow = Button()

view = View(
UItem('test_int'),
UItem('test_scene', editor=SceneEditor()),
UItem('create_arrow'),
resizable=True
)

def _create_arrow_fired(self):
test_pos = [ival / 2 for ival in self.test_scene.get_size()]
this_arrow = tvtk.TextActor(input='test', position=test_pos)
self.test_scene.add_actor(this_arrow)
self.test_scene.render()


test_scene_viewer = TestSceneViewer(test_scene=SceneModel())
test_scene_viewer.configure_traits()
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.