Phoenix Logo

phoenix_title wx.propgrid.PropertyGridManager

wx.propgrid.PropertyGridManager is an efficient multi-page version of wx.propgrid.PropertyGrid, which can optionally have toolbar for mode and page selection, a help text box, and a header.

wx.propgrid.PropertyGridManager inherits from wx.propgrid.PropertyGridInterface, and as such it has most property manipulation functions. However, only some of them affect properties on all pages (eg. GetPropertyByName and ExpandAll while some (eg. Append only apply to the currently selected page.

To operate explicitly on properties on specific page, use wx.propgrid.PropertyGridManager.GetPage to obtain pointer to page’s wx.propgrid.PropertyGridPage object.

Visual methods, such as SetCellBackgroundColour() are only available in wx.propgrid.PropertyGrid. Use wx.propgrid.PropertyGridManager.GetGrid to obtain pointer to it.

Non-virtual iterators will not work in wx.propgrid.PropertyGridManager. Instead, you must acquire the internal grid ( GetGrid) or wx.propgrid.PropertyGridPage object ( GetPage).

wx.propgrid.PropertyGridManager constructor has exact same format as wx.propgrid.PropertyGrid constructor, and basically accepts same extra window style flags (albeit also has some extra ones).

Here’s some example code for creating and populating a wx.propgrid.PropertyGridManager:

pgMan = wx.propgrid.PropertyGridManager(
    parent,
    PGID,
    # These and other similar styles are automatically
    # passed to the embedded wx.PropertyGrid.
    style = wx.PG_BOLD_MODIFIED|wx.PG_SPLITTER_AUTO_CENTER|
    # Include toolbar.
    wx.PG_TOOLBAR |
    # Include description box.
    wx.PG_DESCRIPTION |
    # Include compactor.
    wx.PG_COMPACTOR |
    # Plus defaults.
    wx.PGMAN_DEFAULT_STYLE
  )

page = pgMan.AddPage("First Page")
page.Append(wx.propgrid.PropertyCategory("Category A1"))
page.Append(wx.propgrid.IntProperty("Number", wx.propgrid.PG_LABEL, 1))
page.Append(wx.propgrid.ColourProperty("Colour",wx.propgrid.PG_LABEL, wx.WHITE))

page = pgMan.AddPage("Second Page")
page.Append("Text", wx.propgrid.PG_LABEL, "(no text)")
page.Append(wx.propgrid.FontProperty("Font",wx.propgrid.PG_LABEL))

# Display a header above the grid
pgMan.ShowHeader()

phoenix_title Window Styles

See PropertyGrid Window Styles.

phoenix_title Event Handling

See PropertyGrid Event Handling for more information.


class_hierarchy Class Hierarchy

Inheritance diagram for class PropertyGridManager:

method_summary Methods Summary

__init__ Two step constructor.
AddPage Creates new property page.
Clear Deletes all properties and all pages.
ClearPage Deletes all properties on given page.
CommitChangesFromEditor Forces updating the value of property from the editor control.
Create Two step creation.
CreatePropertyGrid Creates property grid for the manager.
EnableCategories Enables or disables (shows/hides) categories according to parameter enable.
EnsureVisible Selects page, scrolls and/or expands items to ensure that the given item is visible.
GetColumnCount Returns number of columns on given page.
GetCurrentPage Returns currently selected page.
GetDescBoxHeight Returns height of the description text box.
GetGrid Returns pointer to the contained wx.propgrid.PropertyGrid.
GetPage Returns page object for given page index.
GetPageByName Returns index for a page name.
GetPageCount Returns number of managed pages.
GetPageName Returns name of given page.
GetPageRoot Returns “root property” of the given page.
GetSelectedPage Returns index to currently selected page.
GetSelectedProperty Alias for GetSelection .
GetSelection Shortcut for GetGrid . GetSelection .
GetToolBar Returns a pointer to the toolbar currently associated with the wx.propgrid.PropertyGridManager (if any).
GetVIterator Similar to GetIterator, but instead returns wx.propgrid.PGVIterator instance, which can be useful for forward-iterating through arbitrary property containers.
InsertPage Creates new property page.
IsAnyModified Returns True if any property on any page has been modified by the user.
IsFrozen Returns True if updating is frozen (ie.
IsPageModified Returns True if any property on given page has been modified by the user.
IsPropertySelected Returns True if property is selected.
RemovePage Removes a page.
SelectPage Select and displays a given page.
SelectProperty Select a property.
SetColumnCount Sets number of columns on given page (default is current page).
SetColumnTitle Sets a column title.
SetDescBoxHeight Sets y coordinate of the description box splitter.
SetDescription Sets label and text in description box.
SetPageSplitterLeft Moves splitter as left as possible on an individual page, while still allowing all labels to be shown in full.
SetPageSplitterPosition Sets splitter position on individual page.
SetSplitterLeft Moves splitter as left as possible, while still allowing all labels to be shown in full.
SetSplitterPosition Sets splitter position for all pages.
ShowHeader Show or hide the property grid header control.

api Class API



class wx.propgrid.PropertyGridManager(Panel, PropertyGridInterface)

Possible constructors:

PropertyGridManager()

PropertyGridManager(parent, id=ID_ANY, pos=DefaultPosition,
                    size=DefaultSize, style=PGMAN_DEFAULT_STYLE,
                    name=PropertyGridManagerNameStr)

PropertyGridManager is an efficient multi-page version of PropertyGrid, which can optionally have toolbar for mode and page selection, a help text box, and a header.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Two step constructor.

Call Create when this constructor is called to build up the wx.propgrid.PropertyGridManager.



__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=PGMAN_DEFAULT_STYLE, name=PropertyGridManagerNameStr)

The default constructor.

The styles to be used are styles valid for the wx.Window.

Parameters:

See also

Additional Window Styles





AddPage(self, label="", bmp=PG_NULL_BITMAP, pageObj=None)

Creates new property page.

Note that the first page is not created automatically.

Parameters:
  • label (string) – A label for the page. This may be shown as a toolbar tooltip etc.
  • bmp (wx.Bitmap) – Bitmap image for toolbar. If NullBitmap is used, then a built-in default image is used.
  • pageObj (wx.propgrid.PropertyGridPage) – wx.propgrid.PropertyGridPage instance. Manager will take ownership of this object. None indicates that a default page instance should be created.
Return type:

wx.propgrid.PropertyGridPage

Returns:

Returns pointer to created property grid page.

Note

If toolbar is used, it is highly recommended that the pages are added when the toolbar is not turned off using window style flag switching. Otherwise toolbar buttons might not be added properly.



Clear(self)

Deletes all properties and all pages.



ClearPage(self, page)

Deletes all properties on given page.

Parameters:page (int) –


CommitChangesFromEditor(self, flags=0)

Forces updating the value of property from the editor control.

Parameters:flags (wx.int) –
Return type:bool
Returns:Returns True if value was actually updated.


Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=PGMAN_DEFAULT_STYLE, name=PropertyGridManagerNameStr)

Two step creation.

Whenever the control is created without any parameters, use Create to actually create it. Don’t access the control’s public methods before this is called.

Parameters:
Return type:

bool

See also

PropertyGrid Window Styles



CreatePropertyGrid(self)

Creates property grid for the manager.

Reimplement in derived class to use subclassed wx.propgrid.PropertyGrid. However, if you do this then you must also use the two-step construction (ie. default constructor and Create instead of constructor with arguments) when creating the manager.

Return type: wx.propgrid.PropertyGrid


EnableCategories(self, enable)

Enables or disables (shows/hides) categories according to parameter enable.

Parameters:enable (bool) –
Return type:bool

Note

Calling his may not properly update toolbar buttons.



EnsureVisible(self, id)

Selects page, scrolls and/or expands items to ensure that the given item is visible.

Parameters:id (wx.propgrid.PGPropArgCls) –
Return type:bool
Returns:Returns True if something was actually done.


GetColumnCount(self, page=-1)

Returns number of columns on given page.

By the default, returns number of columns on current page.

Parameters:page (int) –
Return type:int


GetCurrentPage(self)

Returns currently selected page.

Return type: wx.propgrid.PropertyGridPage


GetDescBoxHeight(self)

Returns height of the description text box.

Return type:int


GetGrid(self)

Returns pointer to the contained wx.propgrid.PropertyGrid.

This does not change after wx.propgrid.PropertyGridManager has been created, so you can safely obtain pointer once and use it for the entire lifetime of the manager instance.

Return type: wx.propgrid.PropertyGrid


GetPage(self, *args, **kw)

overload Overloaded Implementations:



GetPage (self, ind)

Returns page object for given page index.

Parameters:ind (int) –
Return type: wx.propgrid.PropertyGridPage



GetPage (self, name)

Returns page object for given page name.

Parameters:name (string) –
Return type: wx.propgrid.PropertyGridPage





GetPageByName(self, name)

Returns index for a page name.

If no match is found, wx.NOT_FOUND is returned.

Parameters:name (string) –
Return type:int


GetPageCount(self)

Returns number of managed pages.

Return type:int


GetPageName(self, index)

Returns name of given page.

Parameters:index (int) –
Return type:string


GetPageRoot(self, index)

Returns “root property” of the given page.

It does not have name, etc. and it is not visible. It is only useful for accessing its children.

Parameters:index (int) –
Return type: wx.propgrid.PGProperty


GetSelectedPage(self)

Returns index to currently selected page.

Return type:int


GetSelectedProperty(self)

Alias for GetSelection .

Return type: wx.propgrid.PGProperty


GetSelection(self)

Shortcut for GetGrid . GetSelection .

Return type: wx.propgrid.PGProperty


GetToolBar(self)

Returns a pointer to the toolbar currently associated with the wx.propgrid.PropertyGridManager (if any).

Return type:ToolBar


GetVIterator(self, flags)

Similar to GetIterator, but instead returns wx.propgrid.PGVIterator instance, which can be useful for forward-iterating through arbitrary property containers.

Parameters:flags (int) –
Return type: wx.propgrid.PGVIterator


InsertPage(self, index, label, bmp=NullBitmap, pageObj=None)

Creates new property page.

Note that the first page is not created automatically.

Parameters:
  • index (int) – Add to this position. -1 will add as the last item.
  • label (string) – A label for the page. This may be shown as a toolbar tooltip etc.
  • bmp (wx.Bitmap) – Bitmap image for toolbar. If NullBitmap is used, then a built-in default image is used.
  • pageObj (wx.propgrid.PropertyGridPage) – wx.propgrid.PropertyGridPage instance. Manager will take ownership of this object. If None, default page object is constructed.
Return type:

wx.propgrid.PropertyGridPage

Returns:

Returns pointer to created page.



IsAnyModified(self)

Returns True if any property on any page has been modified by the user.

Return type:bool


IsFrozen(self)

Returns True if updating is frozen (ie.

Freeze called but not yet Thaw ).

Return type:bool


IsPageModified(self, index)

Returns True if any property on given page has been modified by the user.

Parameters:index (int) –
Return type:bool


IsPropertySelected(self, id)

Returns True if property is selected.

Since selection is page based, this function checks every page in the manager.

Parameters:id (wx.propgrid.PGPropArgCls) –
Return type:bool


RemovePage(self, page)

Removes a page.

Parameters:page (int) –
Return type:bool
Returns:Returns False if it was not possible to remove page in question.


SelectPage(self, *args, **kw)

overload Overloaded Implementations:



SelectPage (self, index)

Select and displays a given page.

Parameters:index (int) – Index of page being seleced. Can be -1 to select nothing.



SelectPage (self, label)

Select and displays a given page (by label).

Parameters:label (string) –



SelectPage (self, page)

Select and displays a given page.

Parameters:page (wx.propgrid.PropertyGridPage) –





SelectProperty(self, id, focus=False)

Select a property.

Parameters:
Return type:

bool



SetColumnCount(self, colCount, page=-1)

Sets number of columns on given page (default is current page).

Parameters:
  • colCount (int) –
  • page (int) –

Note

If you use header, then you should always use this member function to set the column count, instead of ones present in wx.propgrid.PropertyGrid or wx.propgrid.PropertyGridPage.



SetColumnTitle(self, idx, title)

Sets a column title.

Default title for column 0 is “Property”, and “Value” for column 1.

Parameters:
  • idx (int) –
  • title (string) –

Note

If header is not shown yet, then calling this member function will make it visible.



SetDescBoxHeight(self, ht, refresh=True)

Sets y coordinate of the description box splitter.

Parameters:
  • ht (int) –
  • refresh (bool) –


SetDescription(self, label, content)

Sets label and text in description box.

Parameters:
  • label (string) –
  • content (string) –


SetPageSplitterLeft(self, page, subProps=False)

Moves splitter as left as possible on an individual page, while still allowing all labels to be shown in full.

Parameters:
  • page (int) –
  • subProps (bool) –


SetPageSplitterPosition(self, page, pos, column=0)

Sets splitter position on individual page.

Parameters:
  • page (int) –
  • pos (int) –
  • column (int) –

Note

If you use header, then you should always use this member function to set the splitter position, instead of ones present in wx.propgrid.PropertyGrid or wx.propgrid.PropertyGridPage.



SetSplitterLeft(self, subProps=False, allPages=True)

Moves splitter as left as possible, while still allowing all labels to be shown in full.

Parameters:
  • subProps (bool) – If False, will still allow sub-properties (ie. properties which parent is not root or category) to be cropped.
  • allPages (bool) – If True, takes labels on all pages into account.


SetSplitterPosition(self, pos, column=0)

Sets splitter position for all pages.

If you use header, then you should always use this member function to set the splitter position, instead of ones present in wx.propgrid.PropertyGrid or wx.propgrid.PropertyGridPage.

Parameters:
  • pos (int) –
  • column (int) –

Note

Splitter position cannot exceed grid size, and therefore setting it during form creation may fail as initial grid size is often smaller than desired splitter position, especially when sizers are being used.



ShowHeader(self, show=True)

Show or hide the property grid header control.

It is hidden by the default.

Parameters:show (bool) –

Note

Grid may look better if you use wx.propgrid.PG_NO_INTERNAL_BORDER window style when showing a header.


Properties



ColumnCount

See GetColumnCount and SetColumnCount



CurrentPage

See GetCurrentPage



DescBoxHeight

See GetDescBoxHeight and SetDescBoxHeight



Grid

See GetGrid



PageCount

See GetPageCount



SelectedPage

See GetSelectedPage



SelectedProperty

See GetSelectedProperty



Selection

See GetSelection



ToolBar

See GetToolBar