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

digraph inheritancefbeb882d36 { rankdir=LR; width=8.0; ratio=compress; fontsize=14; size="8.0, 12.0"; "QtControl" [style="setlinewidth(0.5)",URL="enaml.widgets.control.Control.html#enaml.qt.qt_control.QtControl",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "QtConstraintsWidget" -> "QtControl" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtObject" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25]; "QtConstraintsWidget" [style="setlinewidth(0.5)",URL="enaml.widgets.constraints_widget.ConstraintsWidget.html#enaml.qt.qt_constraints_widget.QtConstraintsWidget",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "QtWidget" -> "QtConstraintsWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtWidget" [style="setlinewidth(0.5)",URL="enaml.widgets.widget.Widget.html#enaml.qt.qt_widget.QtWidget",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "QtObject" -> "QtWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QtImageView" [style="setlinewidth(0.5)",URL="#enaml.qt.qt_image_view.QtImageView",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10]; "QtControl" -> "QtImageView" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

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