phoenix_title wx.propgrid.PropertyGridInterface

Most of the shared property manipulation interface shared by wx.propgrid.PropertyGrid, wx.propgrid.PropertyGridPage, and wx.propgrid.PropertyGridManager is defined in this class.

Note

  • In separate wx.propgrid.PropertyGrid component this class was known as PropertyContainerMethods.

  • wx.propgrid.PropertyGridInterface’s property operation member functions all accept a special PGPropArg id argument, using which you can refer to properties either by their pointer (for performance) or by their name (for conveniency).


class_hierarchy Class Hierarchy

Inheritance diagram for class PropertyGridInterface:

sub_classes Known Subclasses

wx.propgrid.PropertyGrid, wx.propgrid.PropertyGridManager, wx.propgrid.PropertyGridPage


method_summary Methods Summary

Append

Appends property to the list.

AppendIn

Same as Append , but appends under given parent property.

AutoFill

“Clears properties and re-fills to match members and values of

BeginAddChildren

In order to add new items into a property with private children (for instance, wx.propgrid.FlagsProperty), you need to call this method.

ChangePropertyValue

Changes value of a property, as if by user.

Clear

Deletes all properties.

ClearModifiedStatus

Resets modified status of all properties.

ClearSelection

Clears current selection, if any.

Collapse

Collapses given category or property with children.

CollapseAll

Collapses all items that can be collapsed.

DeleteProperty

Removes and deletes a property and any children.

DisableProperty

Disables a property.

DoDefaultTypeMappings

Add built-in properties to the map.

DoDefaultValueTypeMappings

Map pg value type ids to getter methods.

EditorValidate

Returns True if all property grid data changes have been committed.

EnableProperty

Enables or disables property.

EndAddChildren

Called after population of property with fixed children has finished.

Expand

Expands given category or property with children.

ExpandAll

Expands all items that can be expanded.

GetColumnProportion

Returns auto-resize proportion of the given column.

GetEditorByName

Returns editor pointer of editor with given name.

GetFirst

Returns id of first item that matches given criteria.

GetFirstChild

Returns id of first child of given property.

GetIterator

Returns iterator class instance.

GetPropertiesWithFlag

Adds to targetArr pointers to properties that have given flags set.

GetProperty

Returns pointer to a property with given name (case-sensitive).

GetPropertyAttribute

Returns value of given attribute.

GetPropertyAttributes

Returns map-like storage of property’s attributes.

GetPropertyBackgroundColour

Returns background colour of first cell of a property.

GetPropertyByLabel

Returns first property which label matches given string.

GetPropertyByName

Returns pointer to a property with given name (case-sensitive).

GetPropertyByNameA

GetPropertyByName with assertion error message.

GetPropertyCategory

Returns pointer of property’s nearest parent category.

GetPropertyClientData

GetPropertyEditor

Returns property’s editor.

GetPropertyHelpString

Returns help string associated with a property.

GetPropertyImage

Returns property’s custom value image (None of none).

GetPropertyLabel

Returns label of a property.

GetPropertyName

Returns property’s name, by which it is globally accessible.

GetPropertyParent

Returns parent item of a property.

GetPropertyTextColour

Returns text colour of first cell of a property.

GetPropertyValidator

Returns validator of a property as a reference, which you can pass to any number of SetPropertyValidator.

GetPropertyValue

Returns property’s value as Variant .

GetPropertyValueAsArrayInt

Return’s property’s value as ArrayInt.

GetPropertyValueAsArrayString

Returns property’s value as list of strings .

GetPropertyValueAsBool

Returns property’s value as bool.

GetPropertyValueAsDateTime

Return’s property’s value as wx.DateTime.

GetPropertyValueAsDouble

Returns property’s value as double-precision floating point number.

GetPropertyValueAsInt

Returns property’s value as integer.

GetPropertyValueAsLong

Returns property’s value as integer.

GetPropertyValueAsLongLong

Returns property’s value as native signed 64-bit integer.

GetPropertyValueAsString

Returns property’s value as String .

GetPropertyValueAsULong

Returns property’s value as integer.

GetPropertyValueAsULongLong

Returns property’s value as native 64-bit integer.

GetPropertyValues

Returns all property values in the grid.

GetPyIterator

Returns a pythonic property iterator for a single PropertyGrid

GetPyVIterator

Similar to GetVIterator but returns a pythonic iterator.

GetSelectedProperties

Returns list of currently selected properties.

GetSelection

Returns currently selected property.

GetVIterator

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

HideProperty

Hides or reveals a property.

InitAllTypeHandlers

Initializes all property types.

Insert

Inserts property to the property container.

IsPropertyCategory

Returns True if property is a category.

IsPropertyEnabled

Returns True if property is enabled.

IsPropertyExpanded

Returns True if given property is expanded.

IsPropertyModified

Returns True if property has been modified after value set or modify flag clear by software.

IsPropertySelected

Returns True if property is selected.

IsPropertyShown

Returns True if property is shown (i.e.

IsPropertyValueUnspecified

Returns True if property value is set to unspecified.

LimitPropertyEditing

Disables (limit = True) or enables (limit = False) wx.TextCtrl editor of a property, if it is not the sole mean to edit the value.

MapType

Registers Python type/class to property mapping.

RefreshGrid

If state is shown in its grid, refresh it now.

RefreshProperty

RegisterAdditionalEditors

Initializes additional property editors (SpinCtrl etc.).

RegisterEditor

Register a new editor, either an instance or a class.

RemoveProperty

Removes a property.

ReplaceProperty

Replaces property with id with newly created one.

RestoreEditableState

Restores user-editable state.

SaveEditableState

Used to acquire user-editable state (selected property, expanded properties, scrolled position, splitter positions).

SetBoolChoices

Sets strings listed in the choice dropdown of a wx.propgrid.BoolProperty.

SetColumnProportion

Set proportion of an auto-stretchable column.

SetPropVal

Sets value (Variant &) of a property.

SetPropertyAttribute

Sets an attribute for this property.

SetPropertyAttributeAll

Sets property attribute for all applicable properties.

SetPropertyBackgroundColour

Sets background colour of given property.

SetPropertyCell

Sets text, bitmap, and colours for given column’s cell.

SetPropertyClientData

SetPropertyColoursToDefault

Resets text and background colours of given property.

SetPropertyEditor

Sets editor for a property.

SetPropertyHelpString

Associates the help string with property.

SetPropertyImage

Set wx.Bitmap taken from wx.BitmapBundle in front of the value.

SetPropertyLabel

Sets label of a property.

SetPropertyMaxLength

Sets maximum length of text in property text editor.

SetPropertyName

Sets name of a property.

SetPropertyReadOnly

Sets property (and, recursively, its children) to have read-only value.

SetPropertyTextColour

Sets text colour of given property.

SetPropertyValidator

Sets validator of a property.

SetPropertyValue

Sets value (floating point) of a property.

SetPropertyValueString

Sets value (String ) of a property.

SetPropertyValueUnspecified

Sets property’s value to unspecified.

SetPropertyValues

Sets property values from a dictionary.

SetValidationFailureBehavior

Adjusts how wx.propgrid.PropertyGrid behaves when invalid value is entered in a property.

Sort

Sorts all properties recursively.

SortChildren

Sorts children of a property.

_AutoFillMany

_AutoFillOne

_Items

This attribute is a pythonic iterator over all items in this

_Properties

This attribute is a pythonic iterator over all properties in


property_summary Properties Summary

Items

See _Items

Properties

See _Properties


api Class API

class wx.propgrid.PropertyGridInterface(object)

Most of the shared property manipulation interface shared by PropertyGrid, PropertyGridPage, and PropertyGridManager is defined in this class.


Methods

Append(self, property)

Appends property to the list.

wx.propgrid.PropertyGrid assumes ownership of the object. Becomes child of most recently added category.

Parameters:

property (wx.propgrid.PGProperty) –

Return type:

wx.propgrid.PGProperty

Note

  • wx.propgrid.PropertyGrid takes the ownership of the property pointer.

  • If appending a category with name identical to a category already in the wx.propgrid.PropertyGrid, then newly created category is deleted, and most recently added category (under which properties are appended) is set to the one with same name. This allows easier adding of items to same categories in multiple passes.

  • Does not automatically redraw the control, so you may need to call Refresh() when calling this function after control has been shown for the first time.

  • This functions deselects selected property, if any. Validation failure option wx.propgrid.PG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection is cleared even if editor had invalid value.



AppendIn(self, id, newProperty)

Same as Append , but appends under given parent property.

Parameters:
Return type:

wx.propgrid.PGProperty



AutoFill(self, obj, parent=None)

“Clears properties and re-fills to match members and values of the given object or dictionary obj.



BeginAddChildren(self, id)

In order to add new items into a property with private children (for instance, wx.propgrid.FlagsProperty), you need to call this method.

After populating has been finished, you need to call EndAddChildren .

Parameters:

id (wx.propgrid.PGPropArgCls) –

See also

EndAddChildren



ChangePropertyValue(self, id, newValue)

Changes value of a property, as if by user.

Use this instead of SetPropertyValue if you need the value to run through validation process, and also send wxEVT_PG_CHANGED .

Parameters:
Return type:

bool

Returns:

Returns True if value was successfully changed.

Note

Since this function sends wxEVT_PG_CHANGED , it should not be called from EVT_PG_CHANGED handler.



Clear(self)

Deletes all properties.

Note

This functions deselects selected property, if any. Validation failure option wx.propgrid.PG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection is cleared even if editor had invalid value.



ClearModifiedStatus(self)

Resets modified status of all properties.



ClearSelection(self, validation=False)

Clears current selection, if any.

Parameters:

validation (bool) – If set to False, deselecting the property will always work, even if its editor had invalid value in it.

Return type:

bool

Returns:

Returns True if successful or if there was no selection. May fail if validation was enabled and active editor had invalid value.

Note

In wxWidgets 2.9 and later, this function no longer sends PG_EVT_SELECTED .



Collapse(self, id)

Collapses given category or property with children.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool

Returns:

Returns True if actually collapsed.

Note

This function may deselect selected property, if any. Validation failure option wx.propgrid.PG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection is cleared even if editor had invalid value.



CollapseAll(self)

Collapses all items that can be collapsed.

Return type:

bool

Returns:

Return False if failed (may fail if editor value cannot be validated).

Note

This functions clears selection. Validation failure option wx.propgrid.PG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection is cleared even if editor had invalid value.



DeleteProperty(self, id)

Removes and deletes a property and any children.

Parameters:

id (wx.propgrid.PGPropArgCls) – Pointer or name of a property.

This functions deselects selected property, if any. Validation failure option wx.propgrid.PG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection is cleared even if editor had invalid value.

Note

If you delete a property in a wx.propgrid.PropertyGrid event handler, the actual deletion is postponed until the next idle event.



DisableProperty(self, id)

Disables a property.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool

Note

Property is refreshed with new settings.



DoDefaultTypeMappings(self)

Add built-in properties to the map.



DoDefaultValueTypeMappings(self)

Map pg value type ids to getter methods.



EditorValidate(self)

Returns True if all property grid data changes have been committed.

Usually only returns False if value in active editor has been invalidated by a wx.Validator.

Return type:

bool



EnableProperty(self, id, enable=True)

Enables or disables property.

Disabled property usually appears as having grey text.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Name or pointer to a property.

  • enable (bool) – If False, property is disabled instead.

Return type:

bool

Note

Property is refreshed with new settings.



EndAddChildren(self, id)

Called after population of property with fixed children has finished.

Parameters:

id (wx.propgrid.PGPropArgCls) –

See also

BeginAddChildren



Expand(self, id)

Expands given category or property with children.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool

Returns:

Returns True if actually expanded.

Note

This function may deselect selected property, if any. Validation failure option wx.propgrid.PG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection is cleared even if editor had invalid value.



ExpandAll(self, expand=True)

Expands all items that can be expanded.

Parameters:

expand (bool) –

Return type:

bool

Note

This functions clears selection. Validation failure option wx.propgrid.PG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection is cleared even if editor had invalid value.



GetColumnProportion(self, column)

Returns auto-resize proportion of the given column.

Parameters:

column (int) –

Return type:

int



static GetEditorByName(editorName)

Returns editor pointer of editor with given name.

Parameters:

editorName (string) –

Return type:

wx.propgrid.PGEditor



GetFirst(self, flags=PG_ITERATE_ALL)

Returns id of first item that matches given criteria.

Parameters:

flags (int) – See wx.propgrid.PG_ITERATOR_FLAGS.

Return type:

wx.propgrid.PGProperty



GetFirstChild(self, id)

Returns id of first child of given property.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

wx.propgrid.PGProperty

Note

Does not return private children!



GetIterator(self, *args, **kw)

overload Overloaded Implementations:



GetIterator (self, flags=PG_ITERATE_DEFAULT, firstProp=None)

Returns iterator class instance.

Parameters:
  • flags (int) – See wx.propgrid.PG_ITERATOR_FLAGS. Value wx.propgrid.PG_ITERATE_DEFAULT causes iteration over everything except private child properties.

  • firstProp (wx.propgrid.PGProperty) – Property to start iteration from. If None, then first child of root is used.

Return type:

wx.propgrid.PropertyGridIterator



GetIterator (self, flags, startPos)

Returns iterator class instance.

Parameters:
  • flags (int) – See wx.propgrid.PG_ITERATOR_FLAGS. Value wx.propgrid.PG_ITERATE_DEFAULT causes iteration over everything except private child properties.

  • startPos (int) – Either wx.TOP or wx.BOTTOM. wx.TOP will indicate that iterations start from the first property from the top, and wx.BOTTOM means that the iteration will instead begin from bottommost valid item.

Return type:

wx.propgrid.PropertyGridIterator





GetPropertiesWithFlag(self, targetArr, flags, inverse=False, iterFlags=PG_ITERATE_PROPERTIES|PG_ITERATE_HIDDEN|PG_ITERATE_CATEGORIES)

Adds to targetArr pointers to properties that have given flags set.

However, if inverse is set to True, then only properties without given flags are stored.

Parameters:
  • targetArr (ArrayPGProperty) – Array of pointers to properties in which found properties are stored.

  • flags (PGProperty.FlagType) – Property flags to use.

  • inverse (bool) – If False, properties that have given flags are stored, otherwise there are stored only properties without given flags.

  • iterFlags (int) – Iterator flags to use. Default is everything expect private children. See wx.propgrid.PG_ITERATOR_FLAGS.



GetProperty(self, name)

Returns pointer to a property with given name (case-sensitive).

If there is no property with such name, None pointer is returned.

Parameters:

name (string) –

Return type:

wx.propgrid.PGProperty

Note

Properties which have non-category, non-root parent cannot be accessed globally by their name. Instead, use “<property>.<subproperty>” instead of “<subproperty>”.



GetPropertyAttribute(self, id, attrName)

Returns value of given attribute.

If none found, returns NullVariant.

Parameters:
Return type:

PGVariant



GetPropertyAttributes(self, id)

Returns map-like storage of property’s attributes.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

wx.propgrid.PGAttributeStorage

Note

Note that if extra style PG_EX_WRITEONLY_BUILTIN_ATTRIBUTES is set, then builtin-attributes are not included in the storage.



GetPropertyBackgroundColour(self, id)

Returns background colour of first cell of a property.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

Colour



GetPropertyByLabel(self, label)

Returns first property which label matches given string.

None if none found. Note that this operation is very slow when compared to GetPropertyByName .

Parameters:

label (string) –

Return type:

wx.propgrid.PGProperty



GetPropertyByName(self, *args, **kw)

overload Overloaded Implementations:



GetPropertyByName (self, name)

Returns pointer to a property with given name (case-sensitive).

If there is no property with such name, None pointer is returned.

Parameters:

name (string) –

Return type:

wx.propgrid.PGProperty

Note

Properties which have non-category, non-root parent cannot be accessed globally by their name. Instead, use “<property>.<subproperty>” instead of “<subproperty>”.



GetPropertyByName (self, name, subname)

Returns child property subname of property name.

Same as calling GetPropertyByName(“name.subname”), albeit slightly faster.

Parameters:
  • name (string) –

  • subname (string) –

Return type:

wx.propgrid.PGProperty





GetPropertyByNameA(self, name)

GetPropertyByName with assertion error message.

Parameters:

name (string) –

Return type:

wx.propgrid.PGProperty



GetPropertyCategory(self, id)

Returns pointer of property’s nearest parent category.

If no category found, returns None.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

wx.propgrid.PropertyCategory



GetPropertyClientData(self, p)


GetPropertyEditor(self, id)

Returns property’s editor.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

wx.propgrid.PGEditor



GetPropertyHelpString(self, id)

Returns help string associated with a property.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

string



GetPropertyImage(self, id)

Returns property’s custom value image (None of none).

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

Bitmap



GetPropertyLabel(self, id)

Returns label of a property.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

string



GetPropertyName(self, property)

Returns property’s name, by which it is globally accessible.

Parameters:

property (wx.propgrid.PGProperty) –

Return type:

string



GetPropertyParent(self, id)

Returns parent item of a property.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

wx.propgrid.PGProperty



GetPropertyTextColour(self, id)

Returns text colour of first cell of a property.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

Colour



GetPropertyValidator(self, id)

Returns validator of a property as a reference, which you can pass to any number of SetPropertyValidator.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

Validator



GetPropertyValue(self, id)

Returns property’s value as Variant .

If property value is unspecified, NullVariant is returned.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

PGVariant



GetPropertyValueAsArrayInt(self, id)

Return’s property’s value as ArrayInt.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

list of integers



GetPropertyValueAsArrayString(self, id)

Returns property’s value as list of strings .

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

list of strings



GetPropertyValueAsBool(self, id)

Returns property’s value as bool.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool



GetPropertyValueAsDateTime(self, id)

Return’s property’s value as wx.DateTime.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

DateTime



GetPropertyValueAsDouble(self, id)

Returns property’s value as double-precision floating point number.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

float



GetPropertyValueAsInt(self, id)

Returns property’s value as integer.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

int



GetPropertyValueAsLong(self, id)

Returns property’s value as integer.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

long



GetPropertyValueAsLongLong(self, id)

Returns property’s value as native signed 64-bit integer.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

LongLong_t



GetPropertyValueAsString(self, id)

Returns property’s value as String .

If property does not use string value type, then its value is converted using wx.propgrid.PGProperty.GetValueAsString .

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

string



GetPropertyValueAsULong(self, id)

Returns property’s value as integer.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

int



GetPropertyValueAsULongLong(self, id)

Returns property’s value as native 64-bit integer.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

ULongLong_t



GetPropertyValues(self, dict_=None, as_strings=False, inc_attributes=False, flags=PG_ITERATE_PROPERTIES)

Returns all property values in the grid.

Parameters:
  • dict_ – A diftionary to fill with the property values. If not given, then a new one is created. The dict_ can be an object as well, in which case it’s __dict__ is used.

  • as_strings – if True, then string representations of values are fetched instead of native types. Useful for config and such.

  • inc_attributes – if True, then property attributes are added in the form of "@<propname>@<attr>".

  • flags – Flags to pass to the iterator. See wx.propgrid.PG_ITERATOR_FLAGS.

Returns:

A dictionary with values. It is always a dictionary, so if dict_ was an object with __dict__ attribute, then that attribute is returned.



GetPyIterator(self, flags=PG_ITERATE_DEFAULT, firstProperty=None)

Returns a pythonic property iterator for a single PropertyGrid or page in PropertyGridManager . Arguments are same as for GetIterator .

The following example demonstrates iterating absolutely all items in a single grid:

iterator = propGrid.GetPyIterator(wx.propgrid.PG_ITERATE_ALL)
for prop in iterator:
        print(prop)


GetPyVIterator(self, flags=PG_ITERATE_DEFAULT)

Similar to GetVIterator but returns a pythonic iterator.



GetSelectedProperties(self)

Returns list of currently selected properties.

Return type:

ArrayPGProperty

Note

ArrayPGProperty should be compatible with std.vector API.



GetSelection(self)

Returns currently selected property.

None if none.

Return type:

wx.propgrid.PGProperty

Note

When wx.propgrid.PG_EX_MULTIPLE_SELECTION extra style is used, this member function returns the focused property, that is the one which can have active editor.



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) – See wx.propgrid.PG_ITERATOR_FLAGS.

Return type:

wx.propgrid.PGVIterator



HideProperty(self, id, hide=True, flags=PG_RECURSE)

Hides or reveals a property.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Name or pointer to a property.

  • hide (bool) – If True, hides property, otherwise reveals it.

  • flags (int) – By default changes are applied recursively. Set this parameter wx.propgrid.PG_DONT_RECURSE to prevent this.

Return type:

bool



static InitAllTypeHandlers()

Initializes all property types.

Causes references to most object files in the library, so calling this may cause significant increase in executable size when linking with static library.



Insert(self, *args, **kw)

overload Overloaded Implementations:



Insert (self, priorThis, newProperty)

Inserts property to the property container.

Parameters:
  • priorThis (wx.propgrid.PGPropArgCls) – New property is inserted just prior to this. Available only in the first variant. There are two versions of this function to allow this parameter to be either an id or name to a property.

  • newProperty (wx.propgrid.PGProperty) – Pointer to the inserted property. wx.propgrid.PropertyGrid will take ownership of this object.

Return type:

wx.propgrid.PGProperty

  • wx.propgrid.PropertyGrid takes the ownership of the property pointer.

  • While Append may be faster way to add items, make note that when both types of data storage (categoric and non-categoric) are active, Insert becomes even more slow. This is especially True if current mode is non-categoric.

  • This functions deselects selected property, if any. Validation failure option wx.propgrid.PG_VFB_STAY_IN_PROPERTY is not respected, i.e. selection is cleared even if editor had invalid value.

Example of use:

# append category
my_cat_id = thePropGrid.Append(wx.propgrid.PropertyCategory("My Category"))

...

# insert into category - using second variant
my_item_id1 = thePropGrid.Insert(my_cat_id, 0, wx.propgrid.StringProperty("My String 1"))

# insert before to first item - using first variant
my_item_id2 = thePropGrid.Insert(my_item_id, wx.propgrid.StringProperty("My String 2"))
Returns:

Returns newProperty.



Insert (self, parent, index, newProperty)

Inserts property to the property container.

See the other overload for more details.

Parameters:
  • parent (wx.propgrid.PGPropArgCls) – New property is inserted under this category. Available only in the second variant. There are two versions of this function to allow this parameter to be either an id or name to a property.

  • index (int) – Index under category. Available only in the second variant. If index is < 0, property is appended in category.

  • newProperty (wx.propgrid.PGProperty) – Pointer to the inserted property. wx.propgrid.PropertyGrid will take ownership of this object.

Return type:

wx.propgrid.PGProperty

Returns:

Returns newProperty.





IsPropertyCategory(self, id)

Returns True if property is a category.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool



IsPropertyEnabled(self, id)

Returns True if property is enabled.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool



IsPropertyExpanded(self, id)

Returns True if given property is expanded.

Naturally, always returns False for properties that cannot be expanded.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool



IsPropertyModified(self, id)

Returns True if property has been modified after value set or modify flag clear by software.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool



IsPropertySelected(self, id)

Returns True if property is selected.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool



IsPropertyShown(self, id)

Returns True if property is shown (i.e.

HideProperty with True not called for it).

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool



IsPropertyValueUnspecified(self, id)

Returns True if property value is set to unspecified.

Parameters:

id (wx.propgrid.PGPropArgCls) –

Return type:

bool



LimitPropertyEditing(self, id, limit=True)

Disables (limit = True) or enables (limit = False) wx.TextCtrl editor of a property, if it is not the sole mean to edit the value.

Parameters:

Note

Property is refreshed with new settings.



MapType(self, class_, factory)

Registers Python type/class to property mapping.

Parameters:

factory – Property builder function/class.



RefreshGrid(self, state=None)

If state is shown in its grid, refresh it now.

Parameters:

state (wx.propgrid.PropertyGridPageState) –



RefreshProperty(self, p)
Parameters:

p (wx.propgrid.PGProperty) –

Note

This function reselects the property and may cause excess flicker, so to just call Refresh() on a rect of single property, call DrawItem() instead.



static RegisterAdditionalEditors()

Initializes additional property editors (SpinCtrl etc.).

Causes references to most object files in the library, so calling this may cause significant increase in executable size when linking with static library.



RegisterEditor(self, editor, editorName=None)

Register a new editor, either an instance or a class.



RemoveProperty(self, id)

Removes a property.

Does not delete the property object, but instead returns it.

Parameters:

id (wx.propgrid.PGPropArgCls) – Pointer or name of a property.

Return type:

wx.propgrid.PGProperty

Note

Removed property cannot have any children.



ReplaceProperty(self, id, property)

Replaces property with id with newly created one.

For example, this code replaces existing property named “Flags” with one that will have different set of items:

pg.ReplaceProperty("Flags",
    wx.propgrid.FlagsProperty("Flags", wx.propgrid.PG_LABEL, newItems))
Parameters:
Return type:

wx.propgrid.PGProperty

See also

Insert



RestoreEditableState(self, src, restoreStates=AllStates)

Restores user-editable state.

See also wx.propgrid.PropertyGridInterface.SaveEditableState .

Parameters:
  • src (string) – String generated by SaveEditableState.

  • restoreStates (int) – Which parts to restore from source string. See list of editable state flags.

Return type:

bool

Returns:

Returns False if there was problem reading the string.

Note

If some parts of state (such as scrolled or splitter position) fail to restore correctly, please make sure that you call this function after wx.propgrid.PropertyGrid size has been set (this may sometimes be tricky when sizers are used).



SaveEditableState(self, includedStates=AllStates)

Used to acquire user-editable state (selected property, expanded properties, scrolled position, splitter positions).

Parameters:

includedStates (int) – Which parts of state to include. See list of editable state flags.

Return type:

string



static SetBoolChoices(trueChoice, falseChoice)

Sets strings listed in the choice dropdown of a wx.propgrid.BoolProperty.

Defaults are “True” and “False”, so changing them to, say, “Yes” and “No” may be useful in some less technical applications.

Parameters:
  • trueChoice (string) –

  • falseChoice (string) –



SetColumnProportion(self, column, proportion)

Set proportion of an auto-stretchable column.

wx.propgrid.PG_SPLITTER_AUTO_CENTER window style needs to be used to indicate that columns are auto- resizable.

Parameters:
  • column (int) –

  • proportion (int) –

Return type:

bool

Returns:

Returns False on failure.

Note

You should call this for individual pages of wx.propgrid.PropertyGridManager (if used).



SetPropVal(self, id, value)

Sets value (Variant &) of a property.

Same as SetPropertyValue, but accepts reference.

Parameters:


SetPropertyAttribute(self, id, attrName, value, argFlags=0)

Sets an attribute for this property.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Name or pointer to a property.

  • attrName (string) – Text identifier of attribute. See PropertyGrid Property Attribute Identifiers.

  • value (PGVariant) – Value of attribute.

  • argFlags (long) – Optional. Use wx.propgrid.PG_RECURSE to set the attribute to child properties recursively.

Note

  • Setting attribute’s value to NullVariant will simply remove it from property’s set of attributes.

  • Property is refreshed with new settings.



SetPropertyAttributeAll(self, attrName, value)

Sets property attribute for all applicable properties.

Be sure to use this method only after all properties have been added to the grid.

Parameters:
  • attrName (string) –

  • value (PGVariant) –

Note

Properties are refreshed with new settings.



SetPropertyBackgroundColour(self, id, colour, flags=PG_RECURSE)

Sets background colour of given property.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Property name or pointer.

  • colour (wx.Colour) – New background colour.

  • flags (int) – Default is wx.propgrid.PG_RECURSE which causes colour to be set recursively. Omit this flag to only set colour for the property in question and not any of its children.

Note

  • If category is tried to set recursively, only its children are affected.

  • Property is redrawn with new colour.



SetPropertyCell(self, id, column, text="", bitmap=BitmapBundle(), fgCol=NullColour, bgCol=NullColour)

Sets text, bitmap, and colours for given column’s cell.

Parameters:

Note

  • You can set label cell by using column 0.

  • You can use wx.propgrid.PG_LABEL as text to use default text for column.



SetPropertyClientData(self, p, data)


SetPropertyColoursToDefault(self, id, flags=PG_DONT_RECURSE)

Resets text and background colours of given property.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Property name or pointer.

  • flags (int) – Default is wx.propgrid.PG_DONT_RECURSE which causes colour to be reset only for the property in question (for backward compatibility).

Note

  • If category is tried to set recursively, only its children are affected.

  • Property is redrawn with new colours.



SetPropertyEditor(self, *args, **kw)

overload Overloaded Implementations:



SetPropertyEditor (self, id, editor)

Sets editor for a property.

Parameters:

wx.propgrid.PropertyGrid.RegisterEditorClass .



SetPropertyEditor (self, id, editorName)

Sets editor control of a property.

As editor argument, use editor name string, such as “TextCtrl” or “Choice”.

Parameters:





SetPropertyHelpString(self, id, helpString)

Associates the help string with property.

Parameters:

Note

By default, text is shown either in the manager’s “description” text box or in the status bar. If extra window style wx.propgrid.PG_EX_HELP_AS_TOOLTIPS is used, then the text will appear as a tooltip.



SetPropertyImage(self, id, bmp)

Set wx.Bitmap taken from wx.BitmapBundle in front of the value.

Parameters:

Note

Bitmap will be scaled to a size returned by wx.propgrid.PropertyGrid.GetImageSize ;



SetPropertyLabel(self, id, newproplabel)

Sets label of a property.

Parameters:

Note

  • Properties under same parent may have same labels. However, property names must still remain unique.



SetPropertyMaxLength(self, id, maxLen)

Sets maximum length of text in property text editor.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Property name or pointer.

  • maxLen (int) – Maximum number of characters of the text the user can enter in the text editor. If it is 0, the length is not limited and the text can be as long as it is supported by the underlying native text control widget.

Return type:

bool

Returns:

Returns True if maximum length was set.



SetPropertyName(self, id, newName)

Sets name of a property.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Name or pointer of property which name to change.

  • newName (string) – New name for property.



SetPropertyReadOnly(self, id, set=True, flags=PG_RECURSE)

Sets property (and, recursively, its children) to have read-only value.

In other words, user cannot change the value in the editor, but they can still copy it.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Property name or pointer.

  • set (bool) – Use True to enable read-only, False to disable it.

  • flags (int) – By default changes are applied recursively. Set this parameter to wx.propgrid.PG_DONT_RECURSE to prevent this.

Note

  • This is mainly for use with textctrl editor. Only some other editors fully support it.

  • Property is refreshed with new settings.



SetPropertyTextColour(self, id, colour, flags=PG_RECURSE)

Sets text colour of given property.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Property name or pointer.

  • colour (wx.Colour) – New text colour.

  • flags (int) – Default is wx.propgrid.PG_RECURSE which causes colour to be set recursively. Omit this flag to only set colour for the property in question and not any of its children.

Note

  • If category is tried to set recursively, only its children are affected.

  • Property is redrawn with new colour.



SetPropertyValidator(self, id, validator)

Sets validator of a property.

Parameters:


SetPropertyValue(self, *args, **kw)

overload Overloaded Implementations:



SetPropertyValue (self, id, value)

Sets value (floating point) of a property.

Parameters:



SetPropertyValue (self, id, value)

Sets value (bool) of a property.

Parameters:



SetPropertyValue (self, id, value)

Sets value (string) of a property.

Parameters:



SetPropertyValue (self, id, value)

Sets value (list of strings ) of a property.

Parameters:



SetPropertyValue (self, id, value)

Sets value ( wx.DateTime) of a property.

Parameters:



SetPropertyValue (self, id, value)

Sets value (:ref:`wx.Object`&) of a property.

Parameters:



SetPropertyValue (self, id, value)

Sets value (wxArrayInt&) of a property.

Parameters:



SetPropertyValue (self, id, value)

Sets value (Variant ) of a property.

Parameters:

Note

Use ChangePropertyValue instead if you need to run through validation process and send property change event.



SetPropertyValue (self, id, value)

Sets value (long integer) of a property.

Parameters:





SetPropertyValueString(self, id, value)

Sets value (String ) of a property.

Parameters:

Note

This method uses wx.propgrid.PGProperty.SetValueFromString , which all properties should implement. This means that there should not be a type error, and instead the string is converted to property’s actual value type.



SetPropertyValueUnspecified(self, id)

Sets property’s value to unspecified.

If it has children (it may be category), then the same thing is done to them.

Parameters:

id (wx.propgrid.PGPropArgCls) –



SetPropertyValues(self, dict_, autofill=False)

Sets property values from a dictionary.

Parameters:
  • dict_ – the source of the property values to set, which can be either a dictionary or an object with a __dict__ attribute.

  • autofill – If True, keys with not relevant properties are auto-created. For more info, see :method:`AutoFill`.

Note

Keys starting with underscore are ignored. Attributes can be set with entries named like “@<propname>@<attr>”.



SetValidationFailureBehavior(self, vfbFlags)

Adjusts how wx.propgrid.PropertyGrid behaves when invalid value is entered in a property.

Parameters:

vfbFlags (int) – See PropertyGrid Validation Failure behaviour Flags for possible values.



Sort(self, flags=0)

Sorts all properties recursively.

Parameters:

flags (int) – This can contain any of the following options: wx.propgrid.PG_SORT_TOP_LEVEL_ONLY: Only sort categories and their immediate children. Sorting done by wx.propgrid.PG_AUTO_SORT option uses this.

See also

SortChildren , wx.propgrid.PropertyGrid.SetSortFunction



SortChildren(self, id, flags=0)

Sorts children of a property.

Parameters:
  • id (wx.propgrid.PGPropArgCls) – Name or pointer to a property.

  • flags (int) – This can contain any of the following options: wx.propgrid.PG_RECURSE: Sorts recursively.

See also

Sort , wx.propgrid.PropertyGrid.SetSortFunction



_AutoFillMany(self, cat, dict_)


_AutoFillOne(self, cat, k, v)


_Items(self)

This attribute is a pythonic iterator over all items in this PropertyGrid property container, excluding only private child properties. Usage is simple:

for prop in propGrid.Items:
        print(prop)


_Properties(self)

This attribute is a pythonic iterator over all properties in this PropertyGrid property container. It will only skip categories and private child properties. Usage is simple:

for prop in propGrid.Properties:
        print(prop)

Properties

Items

See _Items



Properties

See _Properties