Navigation

  • Home | 
  • Gallery | 
  • API Docs »
  • wx.lib »
  • wx.lib.agw »
  • wx.lib.agw.ribbon »
  • wx.lib.agw.ribbon.gallery »
  • wx.lib.agw.ribbon.gallery.RibbonGallery
  • index
  • modules |
  • next |
  • previous |

Logo of wxPython Phoenix

Table of Contents

  • wx.lib.agw.ribbon.gallery.RibbonGallery
    • Class Hierarchy
    • Control Appearance
    • Known Superclasses
    • Methods Summary
    • Class API

Search

  • Show Source
«

phoenix_title wx.lib.agw.ribbon.gallery.RibbonGallery¶

A ribbon gallery is like a ListBox, but for bitmaps rather than strings.


class_hierarchy Class Hierarchy¶

Inheritance diagram for class RibbonGallery:

Inheritance diagram of RibbonGallery


appearance Control Appearance¶


wxMSW

wxMSW¶

wxMAC

wxMAC¶

wxGTK

wxGTK¶


super_classes Known Superclasses¶

wx.lib.agw.ribbon.control.RibbonControl


method_summary Methods Summary¶

__init__

Default class constructor.

Append

Add an item to the gallery (with complex client data).

CalculateMinSize

Clear

Remove all items from the gallery.

CommonInit

DoGetBestSize

Gets the size which best suits the window: for a control, it would be the

DoGetNextLargerSize

Implementation of RibbonControl.GetNextLargerSize().

DoGetNextSmallerSize

Implementation of RibbonControl.GetNextSmallerSize().

EnsureVisible

Scroll the gallery to ensure that the given item is visible.

GetActiveItem

Get the currently active item, or None if there is none.

GetCount

Get the number of items in the gallery.

GetDefaultBorder

Returns the default border style for RibbonGallery.

GetDownButtonState

Get the state of the scroll down button.

GetExtensionButtonState

Get the state of the “extension” button.

GetHoveredItem

Get the currently hovered item, or None if there is none.

GetItem

Get an item by index.

GetItemClientData

Get the client data associated with a gallery item.

GetSelection

Get the currently selected item, or None if there is none.

GetUpButtonState

Get the state of the scroll up button.

IsEmpty

Query if the gallery has no items in it.

IsHovered

Query is the mouse is currently hovered over the gallery.

IsSizingContinuous

Returns True if this window can take any size (greater than its minimum size),

Layout

Layout() -> bool

OnEraseBackground

Handles the wx.EVT_ERASE_BACKGROUND event for RibbonGallery.

OnMouseDClick

Handles the wx.EVT_LEFT_DCLICK event for RibbonGallery.

OnMouseDown

Handles the wx.EVT_LEFT_DOWN event for RibbonGallery.

OnMouseEnter

Handles the wx.EVT_ENTER_WINDOW event for RibbonGallery.

OnMouseLeave

Handles the wx.EVT_LEAVE_WINDOW event for RibbonGallery.

OnMouseMove

Handles the wx.EVT_MOTION event for RibbonGallery.

OnMouseUp

Handles the wx.EVT_LEFT_UP event for RibbonGallery.

OnPaint

Handles the wx.EVT_PAINT event for RibbonGallery.

OnSize

Handles the wx.EVT_SIZE event for RibbonGallery.

Realize

Perform initial size and layout calculations after children have been added,

ScrollLines

Scroll the gallery contents by some amount.

SetItemClientData

Set the client data associated with a gallery item.

SetSelection

Set the selection to the given item, or removes the selection if item == None.

TestButtonHover


api Class API¶

class RibbonGallery(RibbonControl)¶

A ribbon gallery is like a ListBox, but for bitmaps rather than strings.


Methods¶

__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, agwStyle=0, name='RibbonGallery')¶

Default class constructor.

Parameters:
  • parent – pointer to a parent window, typically a RibbonPanel;

  • id – window identifier. If wx.ID_ANY, will automatically create an identifier;

  • pos – window position. wx.DefaultPosition indicates that wxPython should generate a default position for the window;

  • size – window size. wx.DefaultSize indicates that wxPython should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized;

  • agwStyle – the AGW-specific window style, currently unused;

  • name – the window name.



Append(self, bitmap, id, clientData=None)¶

Add an item to the gallery (with complex client data).

Parameters:
  • bitmap – the bitmap to display for the item. Note that all items must have equally sized bitmaps;

  • id – id number to associate with the item. Not currently used for anything important;

  • clientData – an object which contains data to associate with the item. The item takes ownership of this pointer, and will delete it when the item client data is changed to something else, or when the item is destroyed.



CalculateMinSize(self)¶


Clear(self)¶

Remove all items from the gallery.



CommonInit(self, agwStyle)¶


DoGetBestSize(self)¶

Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call to Fit().

Returns:

An instance of wx.Size.

Note

Overridden from wx.Control.



DoGetNextLargerSize(self, direction, relative_to)¶

Implementation of RibbonControl.GetNextLargerSize().

Controls which have non-continuous sizing must override this virtual function rather than RibbonControl.GetNextLargerSize().



DoGetNextSmallerSize(self, direction, relative_to)¶

Implementation of RibbonControl.GetNextSmallerSize().

Controls which have non-continuous sizing must override this virtual function rather than RibbonControl.GetNextSmallerSize().



EnsureVisible(self, item)¶

Scroll the gallery to ensure that the given item is visible.

Parameters:

item – an instance of RibbonGalleryItem.



GetActiveItem(self)¶

Get the currently active item, or None if there is none.

The active item is the item being pressed by the user, and will thus become the selected item if the user releases the mouse button.



GetCount(self)¶

Get the number of items in the gallery.



GetDefaultBorder(self)¶

Returns the default border style for RibbonGallery.



GetDownButtonState(self)¶

Get the state of the scroll down button.



GetExtensionButtonState(self)¶

Get the state of the “extension” button.



GetHoveredItem(self)¶

Get the currently hovered item, or None if there is none.

The hovered item is the item underneath the mouse cursor.



GetItem(self, n)¶

Get an item by index.

Parameters:

n – the zero-based item in the gallery, which is an instance of RibbonGalleryItem.



GetItemClientData(self, item)¶

Get the client data associated with a gallery item.

Parameters:

item – an instance of RibbonGalleryItem.



GetSelection(self)¶

Get the currently selected item, or None if there is none.

The selected item is set by SetSelection, or by the user clicking on an item.



GetUpButtonState(self)¶

Get the state of the scroll up button.



IsEmpty(self)¶

Query if the gallery has no items in it.



IsHovered(self)¶

Query is the mouse is currently hovered over the gallery.

Returns:

True if the cursor is within the bounds of the gallery (not just hovering over an item), False otherwise.



IsSizingContinuous(self)¶

Returns True if this window can take any size (greater than its minimum size), False if it can only take certain sizes.

See also

RibbonControl.GetNextSmallerSize(), RibbonControl.GetNextLargerSize()



Layout(self)¶

Layout() -> bool

Lays out the children of this window using the associated sizer.



OnEraseBackground(self, event)¶

Handles the wx.EVT_ERASE_BACKGROUND event for RibbonGallery.

Parameters:

event – a EraseEvent event to be processed.



OnMouseDClick(self, event)¶

Handles the wx.EVT_LEFT_DCLICK event for RibbonGallery.

Parameters:

event – a MouseEvent event to be processed.



OnMouseDown(self, event)¶

Handles the wx.EVT_LEFT_DOWN event for RibbonGallery.

Parameters:

event – a MouseEvent event to be processed.



OnMouseEnter(self, event)¶

Handles the wx.EVT_ENTER_WINDOW event for RibbonGallery.

Parameters:

event – a MouseEvent event to be processed.



OnMouseLeave(self, event)¶

Handles the wx.EVT_LEAVE_WINDOW event for RibbonGallery.

Parameters:

event – a MouseEvent event to be processed.



OnMouseMove(self, event)¶

Handles the wx.EVT_MOTION event for RibbonGallery.

Parameters:

event – a MouseEvent event to be processed.



OnMouseUp(self, event)¶

Handles the wx.EVT_LEFT_UP event for RibbonGallery.

Parameters:

event – a MouseEvent event to be processed.



OnPaint(self, event)¶

Handles the wx.EVT_PAINT event for RibbonGallery.

Parameters:

event – a PaintEvent event to be processed.



OnSize(self, event)¶

Handles the wx.EVT_SIZE event for RibbonGallery.

Parameters:

event – a wx.SizeEvent event to be processed.



Realize(self)¶

Perform initial size and layout calculations after children have been added, and/or realize children.



ScrollLines(self, lines)¶

Scroll the gallery contents by some amount.

Parameters:

lines – Positive values scroll toward the end of the gallery, while negative values scroll toward the start.

Returns:

True if the gallery scrolled at least one pixel in the given direction, False if it did not scroll.

Note

Reimplemented from wx.Window.



SetItemClientData(self, item, data)¶

Set the client data associated with a gallery item.

Parameters:
  • item – an instance of RibbonGalleryItem;

  • data – any Python object.



SetSelection(self, item)¶

Set the selection to the given item, or removes the selection if item == None.

Note that this not cause any events to be emitted.

Parameters:

item – an instance of RibbonGalleryItem, can also be None to remove the selection.



TestButtonHover(self, rect, pos, state)¶
© Copyright 2012-2025, The wxPython Team. Created using Sphinx 8.2.3.