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¶
Known Subclasses¶
wx.propgrid.PropertyGrid, wx.propgrid.PropertyGridManager, wx.propgrid.PropertyGridPage
Methods Summary¶
Appends property to the list. |
|
Same as |
|
“Clears properties and re-fills to match members and values of |
|
In order to add new items into a property with private children (for instance, wx.propgrid.FlagsProperty), you need to call this method. |
|
Changes value of a property, as if by user. |
|
Deletes all properties. |
|
Resets modified status of all properties. |
|
Clears current selection, if any. |
|
Collapses given category or property with children. |
|
Collapses all items that can be collapsed. |
|
Removes and deletes a property and any children. |
|
Disables a property. |
|
Add built-in properties to the map. |
|
Map pg value type ids to getter methods. |
|
Returns |
|
Enables or disables property. |
|
Called after population of property with fixed children has finished. |
|
Expands given category or property with children. |
|
Expands all items that can be expanded. |
|
Returns auto-resize proportion of the given column. |
|
Returns editor pointer of editor with given name. |
|
Returns id of first item that matches given criteria. |
|
Returns id of first child of given property. |
|
Returns iterator class instance. |
|
Adds to targetArr pointers to properties that have given flags set. |
|
Returns pointer to a property with given name (case-sensitive). |
|
Returns value of given attribute. |
|
Returns map-like storage of property’s attributes. |
|
Returns background colour of first cell of a property. |
|
Returns first property which label matches given string. |
|
Returns pointer to a property with given name (case-sensitive). |
|
|
|
Returns pointer of property’s nearest parent category. |
|
Returns property’s editor. |
|
Returns help string associated with a property. |
|
Returns property’s custom value image ( |
|
Returns label of a property. |
|
Returns property’s name, by which it is globally accessible. |
|
Returns parent item of a property. |
|
Returns text colour of first cell of a property. |
|
Returns validator of a property as a reference, which you can pass to any number of SetPropertyValidator. |
|
Returns property’s value as Variant . |
|
Return’s property’s value as ArrayInt. |
|
Returns property’s value as list of strings . |
|
Returns property’s value as bool. |
|
Return’s property’s value as wx.DateTime. |
|
Returns property’s value as double-precision floating point number. |
|
Returns property’s value as integer. |
|
Returns property’s value as integer. |
|
Returns property’s value as native signed 64-bit integer. |
|
Returns property’s value as String . |
|
Returns property’s value as integer. |
|
Returns property’s value as native 64-bit integer. |
|
Returns all property values in the grid. |
|
Returns a pythonic property iterator for a single PropertyGrid |
|
Similar to GetVIterator but returns a pythonic iterator. |
|
Returns list of currently selected properties. |
|
Returns currently selected property. |
|
Similar to |
|
Hides or reveals a property. |
|
Initializes all property types. |
|
Inserts property to the property container. |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Disables (limit = |
|
Registers Python type/class to property mapping. |
|
If state is shown in its grid, refresh it now. |
|
Initializes additional property editors (SpinCtrl etc.). |
|
Register a new editor, either an instance or a class. |
|
Removes a property. |
|
Replaces property with id with newly created one. |
|
Restores user-editable state. |
|
Used to acquire user-editable state (selected property, expanded properties, scrolled position, splitter positions). |
|
Sets strings listed in the choice dropdown of a wx.propgrid.BoolProperty. |
|
Set proportion of an auto-stretchable column. |
|
Sets value (Variant &) of a property. |
|
Sets an attribute for this property. |
|
Sets property attribute for all applicable properties. |
|
Sets background colour of given property. |
|
Sets text, bitmap, and colours for given column’s cell. |
|
Resets text and background colours of given property. |
|
Sets editor for a property. |
|
Associates the help string with property. |
|
Set wx.Bitmap taken from wx.BitmapBundle in front of the value. |
|
Sets label of a property. |
|
Sets maximum length of text in property text editor. |
|
Sets name of a property. |
|
Sets property (and, recursively, its children) to have read-only value. |
|
Sets text colour of given property. |
|
Sets validator of a property. |
|
Sets value (floating point) of a property. |
|
Sets value (String ) of a property. |
|
Sets property’s value to unspecified. |
|
Sets property values from a dictionary. |
|
Adjusts how wx.propgrid.PropertyGrid behaves when invalid value is entered in a property. |
|
Sorts all properties recursively. |
|
Sorts children of a property. |
|
This attribute is a pythonic iterator over all items in this |
|
This attribute is a pythonic iterator over all properties in |
Properties Summary¶
See |
|
See |
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:
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:
id (wx.propgrid.PGPropArgCls) – Name or pointer to parent property.
newProperty (wx.propgrid.PGProperty) – Property to be added.
- Return type:
- 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:
- Return type:
None
See also
- 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 sendwxEVT_PG_CHANGED
.- Parameters:
newValue (PGVariant)
- Return type:
bool
- Returns:
Returns
True
if value was successfully changed.
Note
Since this function sends
wxEVT_PG_CHANGED
, it should not be called fromEVT_PG_CHANGED
handler.
- Clear(self)¶
Deletes all properties.
- Return type:
None
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.
- Return type:
None
- 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:
- 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.
- Return type:
None
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:
- Return type:
bool
Note
Property is refreshed with new settings.
See also
- 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.
See also
- EndAddChildren(self, id)¶
Called after population of property with fixed children has finished.
- Parameters:
- Return type:
None
See also
- Expand(self, id)¶
Expands given category or property with children.
- Parameters:
- 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
See also
- static GetEditorByName(editorName)¶
Returns editor pointer of editor with given name.
- Parameters:
editorName (string)
- Return type:
- 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:
- GetFirstChild(self, id)¶
Returns id of first child of given property.
- Parameters:
- Return type:
Note
Does not return private children!
- GetIterator(self, *args, **kw)¶
-
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:
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
orwx.BOTTOM
.wx.TOP
will indicate that iterations start from the first property from the top, andwx.BOTTOM
means that the iteration will instead begin from bottommost valid item.
- Return type:
- 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.
- Return type:
None
- 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:
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:
attrName (string)
- Return type:
PGVariant
- GetPropertyAttributes(self, id)¶
Returns map-like storage of property’s attributes.
- Parameters:
- Return type:
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:
- 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 toGetPropertyByName
.- Parameters:
label (string)
- Return type:
- GetPropertyByName(self, *args, **kw)¶
-
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:
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:
- GetPropertyByNameA(self, name)¶
GetPropertyByName
with assertion error message.- Parameters:
name (string)
- Return type:
- GetPropertyCategory(self, id)¶
Returns pointer of property’s nearest parent category.
If no category found, returns
None
.- Parameters:
- Return type:
- GetPropertyClientData(self, p)¶
- GetPropertyEditor(self, id)¶
Returns property’s editor.
- Parameters:
- Return type:
- GetPropertyHelpString(self, id)¶
Returns help string associated with a property.
- Parameters:
- Return type:
str
- GetPropertyImage(self, id)¶
Returns property’s custom value image (
None
of none).- Parameters:
- Return type:
Bitmap
- GetPropertyLabel(self, id)¶
Returns label of a property.
- Parameters:
- Return type:
str
- GetPropertyName(self, property)¶
Returns property’s name, by which it is globally accessible.
- Parameters:
property (wx.propgrid.PGProperty)
- Return type:
str
- GetPropertyParent(self, id)¶
Returns parent item of a property.
- Parameters:
- Return type:
- GetPropertyTextColour(self, id)¶
Returns text colour of first cell of a property.
- Parameters:
- Return type:
Colour
- GetPropertyValidator(self, id)¶
Returns validator of a property as a reference, which you can pass to any number of SetPropertyValidator.
- Parameters:
- Return type:
Validator
- GetPropertyValue(self, id)¶
Returns property’s value as Variant .
If property value is unspecified, NullVariant is returned.
- Parameters:
- Return type:
PGVariant
- GetPropertyValueAsArrayInt(self, id)¶
Return’s property’s value as ArrayInt.
- Parameters:
- Return type:
List[int]
- GetPropertyValueAsArrayString(self, id)¶
Returns property’s value as list of strings .
- Parameters:
- Return type:
List[str]
- GetPropertyValueAsBool(self, id)¶
Returns property’s value as bool.
- Parameters:
- Return type:
bool
- GetPropertyValueAsDateTime(self, id)¶
Return’s property’s value as wx.DateTime.
- Parameters:
- Return type:
DateTime
- GetPropertyValueAsDouble(self, id)¶
Returns property’s value as double-precision floating point number.
- Parameters:
- Return type:
float
- GetPropertyValueAsInt(self, id)¶
Returns property’s value as integer.
- Parameters:
- Return type:
int
- GetPropertyValueAsLong(self, id)¶
Returns property’s value as integer.
- Parameters:
- Return type:
int
- GetPropertyValueAsLongLong(self, id)¶
Returns property’s value as native signed 64-bit integer.
- Parameters:
- 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:
- Return type:
str
- GetPropertyValueAsULong(self, id)¶
Returns property’s value as integer.
- Parameters:
- Return type:
int
- GetPropertyValueAsULongLong(self, id)¶
Returns property’s value as native 64-bit integer.
- Parameters:
- 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:
List[PGProperty]
Note
ArrayPGProperty should be compatible with std.vector API.
- GetSelection(self)¶
Returns currently selected property.
None
if none.- Return type:
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:
- 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.
- Return type:
None
- Insert(self, *args, **kw)¶
-
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.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:
- Returns:
Returns newProperty.
- IsPropertyCategory(self, id)¶
Returns
True
if property is a category.- Parameters:
- Return type:
bool
- IsPropertyEnabled(self, id)¶
Returns
True
if property is enabled.- Parameters:
- Return type:
bool
- IsPropertyExpanded(self, id)¶
Returns
True
if given property is expanded.Naturally, always returns
False
for properties that cannot be expanded.- Parameters:
- Return type:
bool
- IsPropertyModified(self, id)¶
Returns
True
if property has been modified after value set or modify flag clear by software.- Parameters:
- Return type:
bool
- IsPropertySelected(self, id)¶
Returns
True
if property is selected.- Parameters:
- Return type:
bool
- IsPropertyShown(self, id)¶
Returns
True
if property is shown (i.e.HideProperty
withTrue
not called for it).- Parameters:
- Return type:
bool
- IsPropertyValueUnspecified(self, id)¶
Returns
True
if property value is set to unspecified.- Parameters:
- 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:
limit (bool)
- Return type:
None
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:
- Return type:
None
- RefreshProperty(self, p)¶
- Parameters:
- Return type:
None
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.
- Return type:
None
- 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:
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:
property (wx.propgrid.PGProperty)
- Return type:
See also
- 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:
str
- 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)
- Return type:
None
- 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).
See also
- SetPropVal(self, id, value)¶
Sets value (Variant &) of a property.
Same as SetPropertyValue, but accepts reference.
- Parameters:
value (PGVariant)
- Return type:
None
- 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.
- Return type:
None
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)
- Return type:
None
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.
- Return type:
None
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:
column (int)
text (string)
bitmap (wx.BitmapBundle)
fgCol (wx.Colour)
bgCol (wx.Colour)
- Return type:
None
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).
- Return type:
None
Note
If category is tried to set recursively, only its children are affected.
Property is redrawn with new colours.
- SetPropertyEditor(self, *args, **kw)¶
-
SetPropertyEditor (self, id, editor)
Sets editor for a property.
- Parameters:
id (wx.propgrid.PGPropArgCls) – Property name or pointer to a property.
editor (wx.propgrid.PGEditor) – For builtin editors, use PGEditor_X, where X is builtin editor’s name (TextCtrl, Choice, etc. see wx.propgrid.PGEditor documentation for full list).
- Return type:
None
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:
editorName (string)
- Return type:
None
- SetPropertyHelpString(self, id, helpString)¶
Associates the help string with property.
- Parameters:
helpString (string)
- Return type:
None
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:
bmp (wx.BitmapBundle)
- Return type:
None
Note
Bitmap will be scaled to a size returned by
wx.propgrid.PropertyGrid.GetImageSize
;
- SetPropertyLabel(self, id, newproplabel)¶
Sets label of a property.
- Parameters:
newproplabel (string)
- Return type:
None
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.
See also
- 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.
- Return type:
None
- 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.
- Return type:
None
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.
- Return type:
None
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:
validator (wx.Validator)
- Return type:
None
- SetPropertyValue(self, *args, **kw)¶
-
SetPropertyValue (self, id, value)
Sets value (floating point) of a property.
- Parameters:
value (float)
- Return type:
None
SetPropertyValue (self, id, value)
Sets value (bool) of a property.
- Parameters:
value (bool)
- Return type:
None
SetPropertyValue (self, id, value)
Sets value (string) of a property.
- Parameters:
value (string)
- Return type:
None
SetPropertyValue (self, id, value)
Sets value (list of strings ) of a property.
- Parameters:
value (list of strings)
- Return type:
None
SetPropertyValue (self, id, value)
Sets value ( wx.DateTime) of a property.
- Parameters:
value (wx.DateTime)
- Return type:
None
SetPropertyValue (self, id, value)
Sets value (:ref:`wx.Object`&) of a property.
- Parameters:
value (wx.Object)
- Return type:
None
SetPropertyValue (self, id, value)
Sets value (wxArrayInt&) of a property.
- Parameters:
value (list of integers)
- Return type:
None
SetPropertyValue (self, id, value)
Sets value (Variant ) of a property.
- Parameters:
value (PGVariant)
- Return type:
None
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:
value (long)
- Return type:
None
- SetPropertyValueString(self, id, value)¶
Sets value (String ) of a property.
- Parameters:
value (string)
- Return type:
None
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:
- Return type:
None
- 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.
- Return type:
None
- 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 bywx.propgrid.PG_AUTO_SORT
option uses this.- Return type:
None
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.
- Return type:
None
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¶
- Properties¶
See
_Properties