Media¶
Image example:
from flexx import ui, event
class Example(ui.Widget):
def init(self):
with ui.HBox():
self.stretch = ui.CheckBox(text='Stretch')
with ui.SplitPanel(flex=1):
self.im1 = ui.ImageWidget(source='http://github.com/fluidicon.png')
self.im2 = ui.ImageWidget(source='http://github.com/fluidicon.png')
class JS:
@event.connect('stretch.checked')
def make_stretched(self, *events):
self.im1.stretch = self.im2.stretch = self.stretch.checked
Video example:
from flexx import ui
class Example(ui.Widget):
def init(self):
with ui.HBox():
with ui.SplitPanel(flex=1):
url = 'http://www.w3schools.com/tags/mov_bbb.mp4'
self.vid1 = ui.VideoWidget(source=url)
self.vid2 = ui.YoutubeWidget(source='dhRUe-gz690')
-
class
flexx.ui.
ImageWidget
(*init_args, **kwargs)¶ Inherits from:
Widget
Display an image using a url.
-
source
¶ property – The source of the image, This can be anything that an HTML img element supports.
-
stretch
¶ property – Whether the image should stretch to fill all available space, or maintain its aspect ratio (default).
-