Page Contents

This Page

ImageView

class enaml.widgets.image_view.ImageView(parent=None, **kwargs)[source]

Bases: enaml.widgets.control.Control

A widget which can display an Image with optional scaling.

source = None

The source url of the image to load.

scale_to_fit = None

Whether or not to scale the image with the size of the component.

allow_upscaling = None

Whether to allow upscaling of an image if scale_to_fit is True.

preserve_aspect_ratio = None

Whether or not to preserve the aspect ratio if scaling the image.

hug_width = None

An image view hugs its width weakly by default.

hug_height = None

An image view hugs its height weakly by default.

snapshot()[source]

Returns the dict of creation attribute for the control.

bind()[source]

A method called after initialization which allows the widget to bind any event handlers necessary.

__implements__

alias of __NoInterface__

Backends

Qt

Inheritance diagram of enaml.qt.qt_image_view.QtImageView

class enaml.qt.qt_image_view.QtImageView(object_id, parent, session)[source]

Bases: enaml.qt.qt_control.QtControl

A Qt implementation of an Enaml ImageView widget.

create_widget(parent, tree)[source]

Create the underlying QImageView control.

create(tree)[source]

Create and initialize the underlying control.

activate()[source]

Activate the image view.

This method will request the initial image source for the widget.

on_action_set_source(content)[source]

Handle the ‘set_source’ action from the Enaml widget.

on_action_set_scale_to_fit(content)[source]

Handle the ‘set_scale_to_fit’ action from the Enaml widget.

on_action_set_allow_upscaling(content)[source]

Handle the ‘set_allow_upscaling’ action from the Enaml widget.

on_action_set_preserve_aspect_ratio(content)[source]

Handle the ‘set_preserve_aspect_ratio’ action from the Enaml widget

set_scale_to_fit(scale_to_fit)[source]

Sets whether or not the image scales with the underlying control.

set_allow_upscaling(allow)[source]

Sets whether or not the image will scale beyond its natural size.

set_preserve_aspect_ratio(preserve)[source]

Sets whether or not to preserve the aspect ratio of the image when scaling.

set_source(source)[source]

Set the image source for the underlying widget.

This will trigger a deferred load of the image pointed to by the given source url.

Wx