Using enaml in an existing PyQt app

64 views
Skip to first unread message

Till Stensitzki

unread,
Apr 1, 2019, 4:46:10 PM4/1/19
to Enaml
Hi,

I am little bit stumped: is there a way to embed enaml-containers in an existing pyqt app?
If I try `ContainerBasedView.show()` nothing is shown until i put it into a Window.

greetings
Till

Till Stensitzki

unread,
Apr 1, 2019, 5:21:40 PM4/1/19
to Enaml
Ok, it seems I can get the necessary Qt-widget:

myview = EnamlView(model=model)
myview.initialize()
myview.activate_proxy()
myview.proxy.widget # this is now a QWidget

But this still looks more complicated then necessary. Is there a better way? And is this robust?

greetings Till

Matthieu Dartiailh

unread,
Apr 1, 2019, 8:05:06 PM4/1/19
to Till Stensitzki, Enaml
Hi Till

This should indeed always work. It looks more complicated than you can expect since this not the main use case for enaml. Enaml is designed to build full applications and not only widgets that are to be included in a Qt app. 

Note that you can also do the reverse and integrate a Qt widget in an enaml app using RawWidget.

Best regards

Matthieu

--
You received this message because you are subscribed to the Google Groups "Enaml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enaml+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Till Stensitzki

unread,
Apr 5, 2019, 4:02:48 AM4/5/19
to Enaml
Just for completeness since I stumbled over it:
This approach only works after creating a enaml QtApplication. Since QtApplication reuses an existing QApplication, it can be easily added to the code.


Reply all
Reply to author
Forward
0 new messages