Media widgets

from flexx import ui

class Example(ui.Widget):

    def init(self):
        with ui.HSplit():
            url = 'http://www.w3schools.com/tags/mov_bbb.mp4'
            ui.VideoWidget(source=url)
            ui.YoutubeWidget(source='RG1P8MQS1cU')
            with ui.VBox():
                stretch = ui.CheckBox(text='Stretch')
                ui.ImageWidget(flex=1, stretch=lambda:stretch.checked,
                                source='http://github.com/fluidicon.png')
open in new tab


class flexx.ui.ImageWidget(*init_args, **kwargs)

Inherits from: Widget

Display an image from a url.

The node of this widget is an <img> wrapped in a <div> (the outernode) to handle sizing.

properties: source, stretch

actions: set_source, set_stretch

set_source(*val)

action – Setter for the ‘source’ property.

set_stretch(*val)

action – Setter for the ‘stretch’ property.

source

StringProp – The source of the image, This can be anything that an HTML img element supports.

stretch

BoolProp – Whether the image should stretch to fill all available space, or maintain its aspect ratio (default).

class flexx.ui.VideoWidget(*init_args, **kwargs)

Inherits from: Widget

Display a video from a url.

The node of this widget is a <video>.

properties: source

actions: set_source

set_source(*val)

action – Setter for the ‘source’ property.

source

StringProp – The source of the video. This must be a url of a resource on the web.

class flexx.ui.YoutubeWidget(*init_args, **kwargs)

Inherits from: Widget

Display a Youtube video.

The node of this widget is a <div> containing an <iframe> that loads the youtube page.

properties: source

actions: set_source

set_source(*val)

action – Setter for the ‘source’ property.

source

StringProp – The source of the video represented as the Youtube id.