phoenix_title wx.lib.agw.zoombar

ZoomBar is a class that appoximatively mimics the behaviour of the Mac Dock, inside a Panel.

Description

ZoomBar is a class that appoximatively mimics the behaviour of the Mac Dock, inside a Panel.

Once you hover mouse over the ZoomBar correct button will bubble up, grow to predefined size, so you can easily see the button you are about to click and have larger area to click. Difference this makes is amazing.

The buttons are able to be zoomed from the bottom up (bottom fixed) as well as to zoom from a central point. Also the container is able to move the remaining buttons around the zoomed button.

Usage

Usage example:

import os
import random
import glob

import wx
import wx.lib.agw.zoombar as ZB

class MyFrame(wx.Frame):

    def __init__(self, parent):

        wx.Frame.__init__(self, parent, -1, "ZoomBar Demo")

        panel = wx.Panel(self)

        bar = ZB.ZoomBar(panel, -1)

        standard = glob.glob(bitmapDir + "/*96.png")
        reflections = glob.glob(bitmapDir + "/*96Flip40.png")

        separatorImage = bitmapDir + "/separator.gif"
        separatorReflection = bitmapDir + "/separatorFlip.png"
        count = 0

        for std, ref in zip(standard, reflections):
            if random.randint(0, 1) == 1 and count > 0:
                sep1 = wx.Bitmap(separatorImage, wx.BITMAP_TYPE_GIF)
                sep2 = wx.Bitmap(separatorReflection, wx.BITMAP_TYPE_PNG)
                bar.AddSeparator(sep1, sep2)

            bname = os.path.split(std)[1][0:-6]
            bar.AddButton(wx.Bitmap(std, wx.BITMAP_TYPE_PNG), wx.Bitmap(ref, wx.BITMAP_TYPE_PNG), bname)
            count += 1

        bar.ResetSize()

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(bar, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 15)
        panel.SetSizer(sizer)


# our normal wxApp-derived class, as usual

app = wx.App(0)

frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()

app.MainLoop()

Supported Platforms

ZoomBar has been tested on the following platforms:
  • Windows (Windows XP).

Window Styles

No particular window styles are available for this class.

Events Processing

This class processes the following events:

Event Name

Description

EVT_ZOOMBAR

Process a wxEVT_ZOOMBAR event, when a ZoomBar button is clicked.

License And Version

ZoomBar is distributed under the wxPython license.

Latest Revision: Andrea Gavana @ 19 Dec 2012, 21.00 GMT

Version 0.1

function_summary Functions Summary

MakeDisabledBitmap

Creates a disabled-looking bitmap starting from the input one.


class_summary Classes Summary

ImageBar

This class holds the background button bar on which the buttons float.

ZoomBar

ZoomBar is a class that appoximatively mimics the behaviour of the Mac Dock,

ZoomBarEvent

Event sent from the ZoomBar when a button is activated.

ZoomBarImage

This simple class holds information about a ZoomBar button, such as normal


Functions



MakeDisabledBitmap(original)

Creates a disabled-looking bitmap starting from the input one.

Parameters

original – an instance of wx.Bitmap to be greyed-out.