nucleic / enaml

Declarative User Interfaces for Python
http://enaml.readthedocs.io/en/latest/
Other
1.54k stars 132 forks source link

enable canvas support? #42

Closed msarahan closed 11 years ago

msarahan commented 11 years ago

Is it gone for good, or coming back eventually?

sccolbert commented 11 years ago

I'm not planning on adding any support for any ETS library in the main Enaml project.

I imagine some of this will find it's way into Enthought's compatibility project: https://github.com/enthought/traits-enaml

However, the RawWidget component is now available, so grabbing the control from an Enable canvas and handing it to Enaml is trivial, and something like this should work:

https://github.com/nucleic/enaml/blob/master/enaml/widgets/raw_widget.py

class MyEnableCanvas(RawWidget):

    component = d_(Typed(Component))

    _window = Typed(EnableWindow)

    def create_widget(self, parent):
        self._window = EnableWindow(parent, component=self.component)
        return self._window.control

enamldef Foo(Window):
    Container:
        MyEnableCanvas:
            component = make_plot(...)
brett-patterson commented 11 years ago

@msarahan I recently added an EnableCanvas widget to the traits-enaml library. (https://github.com/enthought/traits-enaml/blob/master/traits_enaml/widgets/enable_canvas.py)