Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/source/enable/traitsui.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Enable TraitsUI Editors
=======================
To facilitate the inclusion of Enable :class:`~.Component` objects in
`TraitsUI GUIs <https://docs.enthought.com/traitsui>`_, Enable provides
:class:`~.ComponentEditor`.
Comment thread
jwiggins marked this conversation as resolved.

ComponentEditor
---------------
:class:`~.ComponentEditor` is a fairly simple editor. It only has a few traits
which are of interest to users:

bgcolor
~~~~~~~
``bgcolor`` is a :class:`ColorTrait` which can be used to specify the background
color of the component. The default value is ``"sys_window"``, which may or may
not match the default window background color of the GUI toolkit you are using.

high_resolution
~~~~~~~~~~~~~~~
``high_resolution`` is a boolean which, if True, tells Enable that you would
like your component to take advantage of HiDPI displays if the GUI toolkit
supports it. The default value is True.

size
~~~~
``size`` is a tuple of integers which can be used to specify the initial size of
the component in a GUI. The default value is ``(400, 400)``.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Enable
enable/basic_tools
enable/drag_and_drop
enable/traits
enable/traitsui
enable/undo_redo
enable/toolkit_selection

Expand Down
12 changes: 6 additions & 6 deletions enable/component_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _get_initial_size(self):


class ComponentEditor(BasicEditorFactory):
""" wxPython editor factory for Enable components.
""" TraitsUI editor factory for Enable components.
"""

# -------------------------------------------------------------------------
Expand All @@ -96,19 +96,19 @@ class ComponentEditor(BasicEditorFactory):
# The class used to create all editor styles (overrides BasicEditorFactory)
klass = _ComponentEditor

# The background color for the window
#: The background color for the window
bgcolor = ColorTrait("sys_window")

# When available, use HiDPI for GraphicsContext rasterization.
#: When available, use HiDPI for GraphicsContext rasterization.
high_resolution = Bool(True)

# The default size of the Window wrapping this Enable component
#: The default size of the Window wrapping this Enable component
size = Tuple((400, 400))

# Convenience function for accessing the width
#: Convenience function for accessing the width
width = Property

# Convenience function for accessing the width
#: Convenience function for accessing the width
height = Property

def _get_width(self):
Expand Down