wx.propgrid.PropertyGrid is a specialized grid for editing properties - in other words name = value pairs.
List of ready-to-use property classes include strings, numbers, flag sets, fonts, colours and many others. It is possible, for example, to categorize properties, set up a complete tree-hierarchy, add more than two columns, and set arbitrary per-property attributes.
Please note that most member functions are inherited and as such not documented on this page. This means you will probably also want to read wx.propgrid.PropertyGridInterface class reference.
See also PropertyGrid Overview.
See PropertyGrid Window Styles.
Please see wx.propgrid.PropertyGridEvent for the documentation of all event types you can use with wx.propgrid.PropertyGrid.
Note
Use Freeze
and Thaw
respectively to disable and enable drawing. This will also delay sorting etc. miscellaneous calculations to the last possible moment.
Two step constructor. |
|
Adds given key combination to trigger given action. |
|
Adds given property into selection. |
|
This static function enables or disables automatic use of |
|
Creates label editor wx.TextCtrl for given column, for property that is currently selected. |
|
Translates the logical coordinates to the device ones. |
|
Translates the device coordinates to the logical ones. |
|
Centers the splitter. |
|
Changes value of a property, as if from an editor. |
|
Deletes all properties. |
|
Clears action triggers for given action. |
|
Forces updating the value of property from the editor control. |
|
Two step creation. |
|
Dedicates a specific keycode to wx.propgrid.PropertyGrid. |
|
Disable use of keyboard keys for scrolling. |
|
Override in derived class to hide an error displayed by |
|
Override to customize property validation failure behaviour. |
|
Override to customize resetting of property validation failure status. |
|
Call this function to prepare the device context for drawing a scrolled image. |
|
Registers a new editor class. |
|
Override in derived class to display error messages in custom manner (these message usually only result from validation failure). |
|
Draws item, children, and consecutive parents as long as category is not met. |
|
Call when editor widget’s contents is modified. |
|
Reverse of |
|
Enables or disables (shows/hides) categories according to parameter enable. |
|
Enable or disable use of |
|
Destroys label editor wx.TextCtrl, if any. |
|
Scrolls and/or expands items to ensure that the given item is visible. |
|
Reduces column sizes to minimum possible, while still retaining fully visible grid contents (labels, images). |
|
Returns current category caption background colour. |
|
Returns current category caption font. |
|
Returns current category caption text colour. |
|
Returns current cell background colour. |
|
Returns current cell text colour when disabled. |
|
Returns current cell text colour. |
|
Returns number of columns currently on grid. |
|
Returns wx.TextCtrl active in currently selected property, if any. |
|
Returns colour of empty space below properties. |
|
Returns height of highest characters of used font. |
|
Returns pointer to itself. |
|
Returns rectangle of custom paint image. |
|
Returns size of the custom paint image in front of property. |
|
Returns currently active label editor, |
|
Returns last item which could be iterated using given flags. |
|
Returns colour of lines between cells. |
|
Returns background colour of margin. |
|
Returns margin width. |
|
Returns wx.Window that the properties are painted on, and which should be used as the parent for editor controls. |
|
Returns “root property”. |
|
Returns height of a single grid row (in pixels). |
|
Get the number of pixels per scroll unit (line), in each direction, as set by |
|
Returns currently selected property. |
|
Returns currently selected property. |
|
Returns current selection background colour. |
|
Returns current selection text colour. |
|
Function which must be overridden to implement the size available for the scroll target for the given size of the main window. |
|
Returns current splitter x position. |
|
Return wx.StatusBar that is used by this wx.propgrid.PropertyGrid. |
|
Returns most up-to-date value of selected property. |
|
Returns current appearance of unspecified value cells. |
|
Returns (visual) text representation of the unspecified property value. |
|
Returns current vertical spacing. |
|
Get the position at which the visible portion of the window starts. |
|
Returns information about arbitrary position in the grid. |
|
Returns |
|
Are we generating the autoscroll events? |
|
Returns |
|
Returns |
|
Returns |
|
Motif only: |
|
Makes given column editable by user. |
|
Called by the default paint event handler to allow the application to define painting behaviour without having to worry about calling |
|
It is recommended that you call this function any time your code causes wx.propgrid.PropertyGrid’s top-level parent to change. |
|
This function is for backwards compatibility only and simply calls |
|
Refreshes any active editor control. |
|
Redraws given property. |
|
Forwards to DoRegisterEditorClass with empty name. |
|
Removes given property from selection. |
|
Resets all colours to the original system values. |
|
Resets column sizes and splitter positions, based on proportions. |
|
Scrolls a window so the view start is at the given point. |
|
Selects a property. |
|
This method can be overridden in a derived class to forbid sending the auto scroll events - note that unlike |
|
Sets category caption background colour. |
|
Sets category caption text colour. |
|
Sets default cell background colour - applies to property cells. |
|
Sets cell text colour for disabled properties. |
|
Sets default cell text colour - applies to property name and value text. |
|
Set number of columns (2 or more). |
|
Sets the ‘current’ category - Append will add non-category properties under it. |
|
Sets colour of empty space below properties. |
|
Sets colour of lines between cells. |
|
Sets background colour of margin. |
|
Set the horizontal and vertical scrolling increment only. |
|
Sets up vertical and/or horizontal scrollbars. |
|
Set entire new selection from given list of properties. |
|
Sets selection background colour - applies to selected property name background. |
|
Sets selection foreground colour - applies to selected property name text. |
|
Moves splitter as left as possible, while still allowing all labels to be shown in full. |
|
Sets x coordinate of the splitter. |
|
Call this function to tell wx.Scrolled to perform the actual scrolling on a different window (and not on itself). |
|
Sets appearance of value cells representing an unspecified property value. |
|
Sets vertical spacing. |
|
Set virtual width for this particular page. |
|
Must be called in |
|
This method can be overridden in a derived class to prevent scrolling the child window into view automatically when it gets focus. |
|
Shows a brief error message that is related to a property. |
|
Set the scrollbar visibility. |
|
Stop generating the scroll events when mouse is held outside the window. |
|
Unfocuses or closes editor if one was open, but does not deselect property. |
|
Call this from |
|
You can use this member function, for instance, to detect in |
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
wx.propgrid.
PropertyGrid
(Control, PropertyGridInterface)¶Possible constructors:
PropertyGrid()
PropertyGrid(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
style=PG_DEFAULT_STYLE, name=PropertyGridNameStr)
PropertyGrid is a specialized grid for editing properties - in other words name = value pairs.
__init__
(self, *args, **kw)¶__init__ (self)
Two step constructor.
Call Create
when this constructor is called to build up the wx.propgrid.PropertyGrid
__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=PG_DEFAULT_STYLE, name=PropertyGridNameStr)
Constructor.
The styles to be used are styles valid for the wx.Window.
See also
PropertyGrid Window Styles.
AddActionTrigger
(self, action, keycode, modifiers=0)¶Adds given key combination to trigger given action.
Here is a sample code to make Enter key press move focus to the next property.
propGrid.AddActionTrigger(wx.propgrid.PG_ACTION_NEXT_PROPERTY,
wx.WXK_RETURN)
propGrid.DedicateKey(wx.WXK_RETURN)
action (int) – Which action to trigger. See PropertyGrid Action Identifiers.
keycode (int) – Which keycode triggers the action.
modifiers (int) – Which key event modifiers, in addition to keycode, are needed to trigger the action.
AddToSelection
(self, id)¶Adds given property into selection.
If PG_EX_MULTIPLE_SELECTION
extra style is not used, then this has same effect as calling SelectProperty
.
id (wx.propgrid.PGPropArgCls) –
bool
Note
Multiple selection is not supported for categories. This means that if you have properties selected, you cannot add category to selection, and also if you have category selected, you cannot add other properties to selection. This member function will fail silently in these cases, even returning True
.
AdjustScrollbars
(self)¶AutoGetTranslation
(enable)¶This static function enables or disables automatic use of wx.GetTranslation
for following strings: wx.propgrid.EnumProperty list labels, wx.propgrid.FlagsProperty child property labels.
Default is False
.
enable (bool) –
BeginLabelEdit
(self, colIndex=0)¶Creates label editor wx.TextCtrl for given column, for property that is currently selected.
When multiple selection is enabled, this applies to whatever property GetSelection
returns.
colIndex (int) – Which column’s label to edit. Note that you should not use value 1, which is reserved for property value column.
See also
CalcScrolledPosition
(self, *args, **kw)¶CalcScrolledPosition (self, x, y)
Translates the logical coordinates to the device ones.
For example, if a window is scrolled 10 pixels to the bottom, the device coordinates of the origin are (0, 0) (as always), but the logical coordinates are (0, 10) and so the call to CalcScrolledPosition(0, 10, xx, yy) will return 0 in yy.
CalcScrolledPosition (self, pt)
CalcUnscrolledPosition
(self, *args, **kw)¶CalcUnscrolledPosition (self, x, y)
Translates the device coordinates to the logical ones.
For example, if a window is scrolled 10 pixels to the bottom, the device coordinates of the origin are (0, 0) (as always), but the logical coordinates are (0, 10) and so the call to CalcUnscrolledPosition(0, 0, xx, yy) will return 10 in yy.
CalcUnscrolledPosition (self, pt)
CenterSplitter
(self, enableAutoResizing=False)¶Centers the splitter.
enableAutoResizing (bool) – If True
, automatic column resizing is enabled (only applicable if window style PG_SPLITTER_AUTO_CENTER
is used).
ChangePropertyValue
(self, id, newValue)¶Changes value of a property, as if from an editor.
Use this instead of SetPropertyValue
if you need the value to run through validation process, and also send wxEVT_PG_CHANGED
.
id (wx.propgrid.PGPropArgCls) –
newValue (PGVariant) –
bool
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.
ClearActionTriggers
(self, action)¶Clears action triggers for given action.
action (int) – Which action to trigger. PropertyGrid Action Identifiers.
CommitChangesFromEditor
(self, flags=0)¶Forces updating the value of property from the editor control.
Note that wxEVT_PG_CHANGING
and wxEVT_PG_CHANGED
are dispatched using ProcessEvent, meaning your event handlers will be called immediately.
flags (wx.int) –
bool
Returns True
if anything was changed.
Create
(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=PG_DEFAULT_STYLE, name=PropertyGridNameStr)¶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
bool
See also
PropertyGrid Window Styles.
DedicateKey
(self, keycode)¶Dedicates a specific keycode to wx.propgrid.PropertyGrid.
This means that such key presses will not be redirected to editor controls.
Using this function allows, for example, navigation between properties using arrow keys even when the focus is in the editor control.
keycode (int) –
DisableKeyboardScrolling
(self)¶Disable use of keyboard keys for scrolling.
By default cursor movement keys (including Home, End, Page Up and Down) are used to scroll the window appropriately. If the derived class uses these keys for something else, e.g. changing the currently selected item, this function can be used to disable this behaviour as it’s not only not necessary then but can actually be actively harmful if another object forwards a keyboard event corresponding to one of the above keys to us using ProcessWindowEvent() because the event will always be processed which can be undesirable.
New in version 2.9.1.
DoHidePropertyError
(self, property)¶Override in derived class to hide an error displayed by DoShowPropertyError
.
property (wx.propgrid.PGProperty) –
See also
DoOnValidationFailure
(self, property, invalidValue)¶Override to customize property validation failure behaviour.
property (wx.propgrid.PGProperty) – Property with entered an invalid value
invalidValue (PGVariant) – Value which failed in validation.
bool
Return True
if user is allowed to change to another property even if current has invalid value.
DoOnValidationFailureReset
(self, property)¶Override to customize resetting of property validation failure status.
property (wx.propgrid.PGProperty) –
Note
Property is guaranteed to have flag PG_PROP_INVALID_VALUE
set.
DoPrepareDC
(self, dc)¶Call this function to prepare the device context for drawing a scrolled image.
It sets the device origin according to the current scroll position. DoPrepareDC
is called automatically within the default wxEVT_PAINT
event handler, so your OnDraw
override will be passed an already ‘pre-scrolled’ device context. However, if you wish to draw from outside of OnDraw
(e.g. from your own wxEVT_PAINT
handler), you must call this function yourself.
For example:
def OnEvent(self, event):
dc = wx.ClientDC(self)
self.DoPrepareDC(dc)
dc.SetPen(wx.BLACK_PEN)
x, y = event.GetPosition()
if (xpos > -1 and ypos > -1 and event.Dragging()):
dc.DrawLine(xpos, ypos, x, y)
xpos = x
ypos = y
Notice that the function sets the origin by moving it relatively to the current origin position, so you shouldn’t change the origin before calling DoPrepareDC
or, if you do, reset it to (0, 0) later. If you call DoPrepareDC
immediately after device context creation, as in the example above, this problem doesn’t arise, of course, so it is customary to do it like this.
dc (wx.DC) –
DoRegisterEditorClass
(editor, name, noDefCheck=False)¶Registers a new editor class.
editor (wx.propgrid.PGEditor) –
name (string) –
noDefCheck (bool) –
Returns pointer to the editor class instance that should be used.
DoShowPropertyError
(self, property, msg)¶Override in derived class to display error messages in custom manner (these message usually only result from validation failure).
property (wx.propgrid.PGProperty) –
msg (string) –
Note
If you implement this, then you also need to implement DoHidePropertyError
- possibly to do nothing, if error does not need hiding (e.g. it was logged or shown in a message box).
See also
DrawItemAndValueRelated
(self, p)¶Draws item, children, and consecutive parents as long as category is not met.
p (wx.propgrid.PGProperty) –
EditorsValueWasModified
(self)¶Call when editor widget’s contents is modified.
For example, this is called when changes text in wx.TextCtrl (used in wx.propgrid.StringProperty and wx.propgrid.IntProperty).
Note
This function should only be called by custom properties.
See also
EditorsValueWasNotModified
(self)¶Reverse of EditorsValueWasModified
.
Note
This function should only be called by custom properties.
EnableCategories
(self, enable)¶Enables or disables (shows/hides) categories according to parameter enable.
enable (bool) –
bool
Note
This functions deselects selected property, if any. Validation failure option PG_VFB_STAY_IN_PROPERTY
is not respected, i.e. selection is cleared even if editor had invalid value.
EnableScrolling
(self, xScrolling, yScrolling)¶Enable or disable use of wx.Window.ScrollWindow
for scrolling.
By default, when a scrolled window is logically scrolled, wx.Window.ScrollWindow
is called on the underlying window which scrolls the window contents and only invalidates the part of the window newly brought into view. If False
is passed as an argument, then this “physical scrolling” is disabled and the window is entirely invalidated whenever it is scrolled by calling wx.Window.Refresh
.
It should be rarely necessary to disable physical scrolling, so this method shouldn’t be called in normal circumstances.
xScrolling (bool) – If True
, enables physical scrolling in the x direction.
yScrolling (bool) – If True
, enables physical scrolling in the y direction.
EndLabelEdit
(self, commit=True)¶Destroys label editor wx.TextCtrl, if any.
commit (bool) – Use True
(default) to store edited label text in property cell data.
See also
EnsureVisible
(self, id)¶Scrolls and/or expands items to ensure that the given item is visible.
id (wx.propgrid.PGPropArgCls) –
bool
Returns True
if something was actually done.
FitColumns
(self)¶Reduces column sizes to minimum possible, while still retaining fully visible grid contents (labels, images).
Size
Minimum size for the grid to still display everything.
Note
Does not work well with PG_SPLITTER_AUTO_CENTER
window style.
GetCaptionBackgroundColour
(self)¶Returns current category caption background colour.
Colour
GetCaptionFont
(self)¶Returns current category caption font.
Font
GetCaptionForegroundColour
(self)¶Returns current category caption text colour.
Colour
GetCellBackgroundColour
(self)¶Returns current cell background colour.
Colour
GetCellDisabledTextColour
(self)¶Returns current cell text colour when disabled.
Colour
GetCellTextColour
(self)¶Returns current cell text colour.
Colour
GetClassDefaultAttributes
(variant=WINDOW_VARIANT_NORMAL)¶variant (WindowVariant) –
VisualAttributes
GetColumnCount
(self)¶Returns number of columns currently on grid.
int
GetEditorTextCtrl
(self)¶Returns wx.TextCtrl active in currently selected property, if any.
Takes wx.adv.OwnerDrawnComboBox into account.
TextCtrl
GetEmptySpaceColour
(self)¶Returns colour of empty space below properties.
Colour
GetFontHeight
(self)¶Returns height of highest characters of used font.
int
GetGrid
(self)¶Returns pointer to itself.
Dummy function that enables same kind of code to use wx.propgrid.PropertyGrid and wx.propgrid.PropertyGridManager.
GetImageRect
(self, property, item)¶Returns rectangle of custom paint image.
property (wx.propgrid.PGProperty) – Return image rectangle for this property.
item (int) – Which choice of property to use (each choice may have different image).
Rect
GetImageSize
(self, property=None, item=-1)¶Returns size of the custom paint image in front of property.
property (wx.propgrid.PGProperty) – Return image rectangle for this property. If this argument is None
, then preferred size is returned.
item (int) – Which choice of property to use (each choice may have different image).
Size
GetLabelEditor
(self)¶Returns currently active label editor, None
if none.
TextCtrl
GetLastItem
(self, flags=PG_ITERATE_DEFAULT)¶Returns last item which could be iterated using given flags.
flags (int) – See PropertyGridIterator Flags.
GetLineColour
(self)¶Returns colour of lines between cells.
Colour
GetMarginColour
(self)¶Returns background colour of margin.
Colour
GetMarginWidth
(self)¶Returns margin width.
int
GetPanel
(self)¶Returns wx.Window that the properties are painted on, and which should be used as the parent for editor controls.
Window
GetRoot
(self)¶Returns “root property”.
It does not have name, etc. and it is not visible. It is only useful for accessing its children.
GetRowHeight
(self)¶Returns height of a single grid row (in pixels).
int
GetScaleX
(self)¶float
GetScaleY
(self)¶float
GetScrollLines
(self, orient)¶orient (int) –
int
GetScrollPageSize
(self, orient)¶orient (int) –
int
GetScrollPixelsPerUnit
(self)¶Get the number of pixels per scroll unit (line), in each direction, as set by SetScrollbars
.
A value of zero indicates no scrolling in that direction.
tuple
GetSelectedProperty
(self)¶Returns currently selected property.
GetSelection
(self)¶Returns currently selected property.
GetSelectionBackgroundColour
(self)¶Returns current selection background colour.
Colour
GetSelectionForegroundColour
(self)¶Returns current selection text colour.
Colour
GetSizeAvailableForScrollTarget
(self, size)¶Function which must be overridden to implement the size available for the scroll target for the given size of the main window.
This method must be overridden if SetTargetWindow
is used (it is never called otherwise). The implementation should decrease the size to account for the size of the non-scrollable parts of the main window and return only the size available for the scrollable window itself. E.g. in the example given in SetTargetWindow
documentation the function would subtract the height of the header window from the vertical component of size.
GetSplitterPosition
(self, splitterIndex=0)¶Returns current splitter x position.
splitterIndex (int) –
int
GetStatusBar
(self)¶Return wx.StatusBar that is used by this wx.propgrid.PropertyGrid.
You can reimplement this member function in derived class to override the default behaviour of using the top-level wx.Frame’s status bar, if any.
GetUncommittedPropertyValue
(self)¶Returns most up-to-date value of selected property.
This will return value different from GetSelectedProperty
.GetValue() only when text editor is activate and string edited by user represents valid, uncommitted property value.
PGVariant
GetUnspecifiedValueAppearance
(self)¶Returns current appearance of unspecified value cells.
See also
GetUnspecifiedValueText
(self, argFlags=0)¶Returns (visual) text representation of the unspecified property value.
argFlags (int) – For internal use only.
string
GetVerticalSpacing
(self)¶Returns current vertical spacing.
int
GetViewStart
(self)¶Get the position at which the visible portion of the window starts.
tuple
HitTest
(self, pt)¶Returns information about arbitrary position in the grid.
pt (wx.Point) – Coordinates in the virtual grid space. You may need to use wx.Scrolled.CalcScrolledPosition
for translating wx.propgrid.PropertyGrid client coordinates into something this member function can use.
IsAnyModified
(self)¶Returns True
if any property has been modified by the user.
bool
IsAutoScrolling
(self)¶Are we generating the autoscroll events?
bool
IsEditorFocused
(self)¶Returns True
if a property editor control has focus.
bool
IsEditorsValueModified
(self)¶Returns True
if editor’s value was marked modified.
bool
IsFrozen
(self)¶Returns True
if updating is frozen (i.e.
Freeze
called but not yet Thaw
).
bool
IsRetained
(self)¶Motif only: True
if the window has a backing bitmap.
bool
MakeColumnEditable
(self, column, editable=True)¶Makes given column editable by user.
column (int) – The index of the column to make editable.
editable (bool) – Using False
here will disable column from being editable.
column must not be equal to 1, as the second column is always editable and can be made read-only only on cell-by-cell basis using:
property.ChangeFlag(wx.propgrid.PG_PROP_READONLY, True)
See also
OnDraw
(self, dc)¶Called by the default paint event handler to allow the application to define painting behaviour without having to worry about calling DoPrepareDC
.
Instead of overriding this function you may also just process the paint event in the derived class as usual, but then you will have to call DoPrepareDC
yourself.
dc (wx.DC) –
OnTLPChanging
(self, newTLP)¶It is recommended that you call this function any time your code causes wx.propgrid.PropertyGrid’s top-level parent to change.
wx.propgrid.PropertyGrid’s OnIdle() handler should be able to detect most changes, but it is not perfect.
newTLP (wx.Window) – New top-level parent that is about to be set. Old top-level parent window should still exist as the current one.
Note
This function is automatically called from wx.propgrid.PropertyGrid:: Reparent
and wx.propgrid.PropertyGridManager.Reparent
. You only need to use it if you reparent wx.propgrid.PropertyGrid indirectly.
PrepareDC
(self, dc)¶This function is for backwards compatibility only and simply calls DoPrepareDC
now.
Notice that it is not called by the default paint event handle ( DoPrepareDC
is), so overriding this method in your derived class is useless.
dc (wx.DC) –
RefreshEditor
(self)¶Refreshes any active editor control.
RefreshProperty
(self, p)¶Redraws given property.
p (wx.propgrid.PGProperty) –
RegisterEditorClass
(editor, noDefCheck=False)¶Forwards to DoRegisterEditorClass with empty name.
editor (wx.propgrid.PGEditor) –
noDefCheck (bool) –
RemoveFromSelection
(self, id)¶Removes given property from selection.
If property is not selected, an assertion failure will occur.
id (wx.propgrid.PGPropArgCls) –
bool
ResetColours
(self)¶Resets all colours to the original system values.
ResetColumnSizes
(self, enableAutoResizing=False)¶Resets column sizes and splitter positions, based on proportions.
enableAutoResizing (bool) – If True
, automatic column resizing is enabled (only applicable if window style PG_SPLITTER_AUTO_CENTER
is used).
Scroll
(self, *args, **kw)¶Scroll (self, x, y)
Scrolls a window so the view start is at the given point.
x (int) – The x position to scroll to, in scroll units.
y (int) – The y position to scroll to, in scroll units.
Note
The positions are in scroll units, not pixels, so to convert to pixels you will have to multiply by the number of pixels per scroll increment. If either parameter is wx.DefaultCoord
(-1), that position will be ignored (no change in that direction).
See also
SetScrollbars
, GetScrollPixelsPerUnit
Scroll (self, pt)
This is an overload of Scroll
; see that function for more info.
pt (wx.Point) –
SelectProperty
(self, id, focus=False)¶Selects a property.
Editor widget is automatically created, but not focused unless focus is True
.
id (wx.propgrid.PGPropArgCls) – Property to select (name or pointer).
focus (bool) – If True
, move keyboard focus to the created editor right away.
bool
returns True
if selection finished successfully. Usually only fails if current value in editor is not valid.
Note
In wxWidgets 2.9 and later, this function no longer sends wxEVT_PG_SELECTED
.
SendAutoScrollEvents
(self, event)¶This method can be overridden in a derived class to forbid sending the auto scroll events - note that unlike StopAutoScrolling
it doesn’t stop the timer, so it will be called repeatedly and will typically return different values depending on the current mouse position.
The base class version just returns True
.
event (wx.ScrollWinEvent) –
bool
SetCaptionBackgroundColour
(self, col)¶Sets category caption background colour.
col (wx.Colour) –
SetCellBackgroundColour
(self, col)¶Sets default cell background colour - applies to property cells.
Note that appearance of editor widgets may not be affected.
col (wx.Colour) –
SetCellDisabledTextColour
(self, col)¶Sets cell text colour for disabled properties.
col (wx.Colour) –
SetCellTextColour
(self, col)¶Sets default cell text colour - applies to property name and value text.
Note that appearance of editor widgets may not be affected.
col (wx.Colour) –
SetColumnCount
(self, colCount)¶Set number of columns (2 or more).
colCount (int) –
SetCurrentCategory
(self, id)¶Sets the ‘current’ category - Append will add non-category properties under it.
id (wx.propgrid.PGPropArgCls) –
SetEmptySpaceColour
(self, col)¶Sets colour of empty space below properties.
col (wx.Colour) –
SetScale
(self, xs, ys)¶xs (float) –
ys (float) –
SetScrollPageSize
(self, orient, pageSize)¶orient (int) –
pageSize (int) –
SetScrollRate
(self, xstep, ystep)¶Set the horizontal and vertical scrolling increment only.
See the pixelsPerUnit parameter in SetScrollbars
.
xstep (int) –
ystep (int) –
SetScrollbars
(self, pixelsPerUnitX, pixelsPerUnitY, noUnitsX, noUnitsY, xPos=0, yPos=0, noRefresh=False)¶Sets up vertical and/or horizontal scrollbars.
The first pair of parameters give the number of pixels per ‘scroll step’, i.e. amount moved when the up or down scroll arrows are pressed. The second pair gives the length of scrollbar in scroll steps, which sets the size of the virtual window.
xPos and yPos optionally specify a position to scroll to immediately.
For example, the following gives a window horizontal and vertical scrollbars with 20 pixels per scroll step, and a size of 50 steps (1000 pixels) in each direction:
window.SetScrollbars(20, 20, 50, 50)
wx.Scrolled manages the page size itself, using the current client window size as the page size.
Note that for more sophisticated scrolling applications, for example where scroll steps may be variable according to the position in the document, it will be necessary to derive a new class from wx.Window, overriding OnSize() and adjusting the scrollbars appropriately.
pixelsPerUnitX (int) – Pixels per scroll unit in the horizontal direction.
pixelsPerUnitY (int) – Pixels per scroll unit in the vertical direction.
noUnitsX (int) – Number of units in the horizontal direction.
noUnitsY (int) – Number of units in the vertical direction.
xPos (int) – Position to initialize the scrollbars in the horizontal direction, in scroll units.
yPos (int) – Position to initialize the scrollbars in the vertical direction, in scroll units.
noRefresh (bool) – Will not refresh window if True
.
See also
SetSelection
(self, newSelection)¶Set entire new selection from given list of properties.
newSelection (ArrayPGProperty) –
SetSelectionBackgroundColour
(self, col)¶Sets selection background colour - applies to selected property name background.
col (wx.Colour) –
SetSelectionTextColour
(self, col)¶Sets selection foreground colour - applies to selected property name text.
col (wx.Colour) –
SetSplitterLeft
(self, privateChildrenToo=False)¶Moves splitter as left as possible, while still allowing all labels to be shown in full.
privateChildrenToo (bool) – If False
, will still allow private children to be cropped.
SetSplitterPosition
(self, newxpos, col=0)¶Sets x coordinate of the splitter.
newxpos (int) –
col (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.
SetTargetWindow
(self, window)¶Call this function to tell wx.Scrolled to perform the actual scrolling on a different window (and not on itself).
This method is useful when only a part of the window should be scrolled. A typical example is a control consisting of a fixed header and the scrollable contents window: the scrollbars are attached to the main window itself, hence it, and not the contents window must be derived from wx.Scrolled, but only the contents window scrolls when the scrollbars are used. To implement such setup, you need to call this method with the contents window as argument.
Notice that if this method is used, GetSizeAvailableForScrollTarget
method must be overridden.
window (wx.Window) –
SetUnspecifiedValueAppearance
(self, cell)¶Sets appearance of value cells representing an unspecified property value.
Default appearance is blank.
cell (wx.propgrid.PGCell) –
Note
If you set the unspecified value to have any textual representation, then that will override “InlineHelp” attribute.
SetVerticalSpacing
(self, vspacing)¶Sets vertical spacing.
Can be 1, 2, or 3 - a value relative to font height. Value of 2 should be default on most platforms.
vspacing (int) –
SetVirtualWidth
(self, width)¶Set virtual width for this particular page.
Width -1 indicates that the virtual width should be disabled.
width (int) –
SetupTextCtrlValue
(self, text)¶Must be called in wx.propgrid.PGEditor.CreateControls
if primary editor window is wx.TextCtrl, just before textctrl is created.
text (string) – Initial text value of created wx.TextCtrl.
ShouldScrollToChildOnFocus
(self, child)¶This method can be overridden in a derived class to prevent scrolling the child window into view automatically when it gets focus.
The default behaviour is to scroll this window to show its currently focused child automatically, to ensure that the user can interact with it. This is usually helpful, but can be undesirable for some windows, in which case this method can be overridden to return False
for them to prevent any scrolling from taking place when such windows get focus.
child (wx.Window) –
bool
New in version 4.1/wxWidgets-3.1.3.
ShowPropertyError
(self, id, msg)¶Shows a brief error message that is related to a property.
id (wx.propgrid.PGPropArgCls) –
msg (string) –
ShowScrollbars
(self, horz, vert)¶Set the scrollbar visibility.
By default the scrollbar in the corresponding direction is only shown if it is needed, i.e. if the virtual size of the scrolled window in this direction is greater than the current physical window size. Using this function the scrollbar visibility can be changed to be:
wx.SHOW_SB_ALWAYS
: To always show the scrollbar, even if it is not needed currently (wx``wx.ALWAYS_SHOW_SB`` style can be used during the window creation to achieve the same effect but it applies in both directions).
wx.SHOW_SB_NEVER
: To never show the scrollbar at all. In this case the program should presumably provide some other way for the user to scroll the window.
wx.SHOW_SB_DEFAULT
: To restore the default behaviour described above.
Note that the window must be created before calling this method.
horz (ScrollbarVisibility) – The desired visibility for the horizontal scrollbar.
vert (ScrollbarVisibility) – The desired visibility for the vertical scrollbar.
New in version 2.9.0.
StopAutoScrolling
(self)¶Stop generating the scroll events when mouse is held outside the window.
UnfocusEditor
(self)¶Unfocuses or closes editor if one was open, but does not deselect property.
bool
ValueChangeInEvent
(self, variant)¶Call this from wx.propgrid.PGProperty.OnEvent
to cause property value to be changed after the function returns (with True
as return value).
ValueChangeInEvent
must be used if you wish the application to be able to use wxEVT_PG_CHANGING to potentially veto the given value.
variant (PGVariant) –
WasValueChangedInEvent
(self)¶You can use this member function, for instance, to detect in wx.propgrid.PGProperty.OnEvent
if wx.propgrid.PGProperty.SetValueInEvent
was already called in wx.propgrid.PGEditor.OnEvent
.
It really only detects if was value was changed using wx.propgrid.PGProperty.SetValueInEvent
, which is usually used when a ‘picker’ dialog is displayed. If value was written by “normal means” in wx.propgrid.PGProperty.StringToValue
or IntToValue(), then this function will return False
(on the other hand, wx.propgrid.PGProperty.OnEvent
is not even called in those cases).
bool
CaptionBackgroundColour
¶See GetCaptionBackgroundColour
and SetCaptionBackgroundColour
CaptionFont
¶See GetCaptionFont
CaptionForegroundColour
¶CellBackgroundColour
¶CellDisabledTextColour
¶CellTextColour
¶See GetCellTextColour
and SetCellTextColour
ColumnCount
¶See GetColumnCount
and SetColumnCount
EditorTextCtrl
¶EmptySpaceColour
¶FontHeight
¶See GetFontHeight
ImageSize
¶See GetImageSize
LabelEditor
¶See GetLabelEditor
LastItem
¶See GetLastItem
LineColour
¶See GetLineColour
and SetLineColour
MarginColour
¶See GetMarginColour
and SetMarginColour
MarginWidth
¶See GetMarginWidth
RowHeight
¶See GetRowHeight
SelectedProperty
¶Selection
¶See GetSelection
and SetSelection
SelectionBackgroundColour
¶See GetSelectionBackgroundColour
and SetSelectionBackgroundColour
SelectionForegroundColour
¶SplitterPosition
¶StatusBar
¶See GetStatusBar
TargetRect
¶See GetTargetRect
and SetTargetRect
TargetWindow
¶See GetTargetWindow
and SetTargetWindow
UncommittedPropertyValue
¶UnspecifiedValueAppearance
¶See GetUnspecifiedValueAppearance
and SetUnspecifiedValueAppearance
UnspecifiedValueText
¶VerticalSpacing
¶See GetVerticalSpacing
and SetVerticalSpacing