Coverflow: a coverflow widget

# Jump directly to Examples

Coverflow: a coverflow widget

class pymt.ui.widgets.coverflow.MTCoverFlow(**kwargs)

Bases: pymt.ui.widgets.widget.MTWidget

A coverflow widget, that support mostly any widget in :)

Parameters :
cover_angle : int, default to 90

Angle to turn cover when they are displayed on the left/right side

cover_distance : int, default to 400

Distance in pixels for starting drawing left/right side from the current displayed cover

cover_spacing : int, default to 50

Distance in pixels between covers

cover_blend : bool, default to False

Activate background blending for the cover. If you set a background color, without blending, the blending will look wrong. Activate blending if you want to use your background color for fading or if you want to use a img with an alpha channel (i.e. png with transparent background)

cover_blend_start : float, default 1.0

Alpha value to use for the cover blending (0 means transparent)

cover_blend_stop : float, default to 1.0

Alpha value to use for the cover blending

reflection_blend : bool, default to False

Activate background blending for reflection. If you set a background color, without blending, the reflection will look wrong. Activate blending if you want to use your background color for fading.

reflection_percent : float, default to 0.3

Percentage of the thumbnail height to be showed. For example, if the thumbnail is 400 height, and reflection_percent is 0.4, only (0.3 * 400) pixels will be showed for reflection

reflection_start : float, default 0.4

Alpha value to use for top reflection (0 mean transparent)

reflection_stop : float, default to 0

Alpha value to use for the bottom reflection

thumbnail_size : list, default to (400, 400)

Size of a thumbnail

trigger_cover_distance : int, default to 30

Distance in pixels to trigger the switch of cover

trigger_distance : int, default to 3

Distance within a click is considered and fired

title_attributes : dict, default to {}

Attributes to pass to drawLabel

title_draw : bool, default to True

If a title attribute is found on the child, it will be drawed on screen

title_position : int, default to -50

Y position of title (starting from the bottom of the cover)

Events :
on_change : widget

Fired when the selected cover change

on_select : widget

Fired when the user “click” on the current cover

Examples

File ui_widgets_coverflow.py

from pymt import *
from glob import glob
from OpenGL.GL import *
import os

if __name__ == '__main__':
    base_image = os.path.join(os.path.dirname(__file__),
                              '..', 'pictures', 'images')
    w = getWindow()
    coverflow = MTCoverFlow(size=w.size)
    for filename in glob(os.path.join(base_image, '*.jpg')):
        button = MTImageButton(image=Loader.image(filename))
        button.title = os.path.basename(filename)
        coverflow.add_widget(button)

    runTouchApp(coverflow)

Table Of Contents

Previous topic

Container: easy way to convert a simple BaseObject into a widget

Next topic

Dragable widget: a moveable widget over the window

This Page