domdf_wxpython_tools
Tools and widgets for wxPython.
Docs |
|
---|---|
Tests |
|
PyPI |
|
Activity |
|
QA |
|
Other |
Installation
python3 -m pip install domdf_wxpython_tools --user
python3 -m pip install git+https://github.com/domdfcoding/domdf_wxpython_tools@master --user
ColourPickerPanel
Based on StylePickerPanel, a Panel for selecting a list of colours, and their order
Classes:
|
Based on StylePickerPanel, a Panel for selecting a list of colours, and their order. |
-
class
ColourPickerPanel
(parent, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=524288, name=b'panel', label='Choose Colours: ', picker_choices=None, selection_choices=None)[source] Bases:
StylePickerPanel
Based on StylePickerPanel, a Panel for selecting a list of colours, and their order.
- Parameters
parent (
Window
) – The parent window.id (
int
) – An identifier for the panel. wx.ID_ANY is taken to mean a default. Default-1
.pos (
Point
) – The panel position. The valuewx.DefaultPosition
indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.size (
Size
) – The panel size. The valuewx.DefaultSize
indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.style (
int
) – The window style. See wxPanel. Default524288
.name (
str
) – The window name. Defaultb'panel'
.label (
str
) – Label for the panel. Default'Choose Colours: '
.picker_choices (
Optional
[List
[str
]]) – A list of hex value choices to populate the ‘picker’ side of the panel with. DefaultNone
.selection_choices (
Optional
[List
[str
]]) – A list of hex value choices to populate the ‘selection’ side of the panel with. DefaultNone
.
Methods:
Returns a list of the currently selected colours
add
(event)Event handler for adding the colour currently selected in the ‘picker’ to the ‘selection’
Returns a list of the currently selected colours
pick
(*args)Open a
wx.ColourDialog
to edit the colour currently selected in the picker.remove
(event)Event handler for removing the colour currently selected in the ‘selection’
update_preview
(list_obj, axes)Update the preview from the given list.
-
add
(event)[source] Event handler for adding the colour currently selected in the ‘picker’ to the ‘selection’
-
pick
(*args)[source] Open a
wx.ColourDialog
to edit the colour currently selected in the picker.
StylePickerPanel
Classes:
|
Based on StylePickerPanel, a Panel for selecting a list of colours, and their order. |
-
class
StylePickerPanel
(parent, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=524288, name=b'panel', label='Choose Styles: ', selection_choices=None)[source] Bases:
Panel
Based on StylePickerPanel, a Panel for selecting a list of colours, and their order.
- Parameters
parent (
Window
) – The parent window.id – An identifier for the panel. wx.ID_ANY is taken to mean a default. Default
-1
.pos – The panel position. The value
wx.DefaultPosition
indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.size – The panel size. The value
wx.DefaultSize
indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.style – The window style. See wxPanel. Default
524288
.name – The window name. Default
b'panel'
.label – Label for the panel. Default
'Choose Styles: '
.selection_choices (
Optional
[List
[str
]]) – A list of hex value choices to populate the ‘selection’ side of the panel with. DefaultNone
.
Methods:
add
(event)move
([direction])move_down
(event)move_up
(event)remove
(event)update_preview
(list_obj, axes)-
do_layout
()
-
set_properties
()
WebView
Set the emulation level for wxWidgets WebView purely in Python.
Notes:
The highest emulation level may be used even when the corresponding browser version is not installed.
Using the
*_FORCE
options is not recommended.The
wxWEBVIEWIE_EMU_DEFAULT
can be used to reset the emulation level to the system default.
The values of the constants were taken from https://msdn.microsoft.com/library/ee330730.aspx#browser_emulation and must not be changed.
Functions:
|
Sets the emulation level for wxWidgets WebView. |
Data:
The system default browser emulation level. |
|
Emulate Internet Explorer 10 |
|
Emulate Internet Explorer 10 (force) |
|
Emulate Internet Explorer 11 |
|
Emulate Internet Explorer 12 (force) |
|
Emulate Internet Explorer 7 |
|
Emulate Internet Explorer 8 |
|
Emulate Internet Explorer 8 (force) |
|
Emulate Internet Explorer 9 |
|
Emulate Internet Explorer 9 (force) |
-
MSWSetEmulationLevel
(level=0, program_name=None)[source] Sets the emulation level for wxWidgets WebView.
- Parameters
level – The emulation level to use. Default
0
.program_name – The name of the program to set the emulation level for. Defaults to the Python executable.
- Returns
Whether the operation completed successfully.
border_config
Dialog for configuring borders for charts.
Classes:
|
|
-
class
border_config
(parent, chromatogram_figure, *args, **kwds)[source] Bases:
Dialog
- Parameters
parent (
Window
)chromatogram_figure
*args
**kwds
Methods:
close_dialog
(_)
chartpanel
A canvas for displaying a chart within a wxPython window
Classes:
|
Panel that contains a matplotlib plotting window, used for displaying an image. |
-
class
ChartPanelBase
(parent, fig, ax, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=0, name=b'panel')[source] Bases:
Panel
Panel that contains a matplotlib plotting window, used for displaying an image. The image can be right clicked to bring up a context menu allowing copying, pasting and saving of the image. The image can be panned by holding the left mouse button and moving the mouse, and zoomed in and out using the scrollwheel on the mouse.
- Parameters
parent (
Window
) – The parent window.fig (
Figure
)ax (
Axes
)id (
int
) – An identifier for the panel. wx.ID_ANY is taken to mean a default. Default-1
.pos (
Point
) – The panel position. The valuewx.DefaultPosition
indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.size (
Size
) – The panel size. The value ::wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.style (
int
) – The window style. See wxPanel. Default0
.name (
str
) – Window name. Defaultb'panel'
.
Methods:
configure_borders
([event])Open the
Configure Borders
dialog.constrain_zoom
([key])Constrain zoom to the x axis only.
Event handler for size change events
pan
([enable])Enable the Pan tool.
previous_view
(*_)Go to the previous view of the chart.
reset_view
(*_)Reset the view of the chart.
setup_scrollwheel_zooming
([scale])Allow zooming of the chart with the scrollwheel.
setup_ylim_refresher
(y_data, x_data)Setup the function for updating the ylim whenever the xlim changes.
Internal function that runs whenever the window is resized.
zoom
([enable])Enable the Zoom tool.
-
constrain_zoom
(key='x')[source] Constrain zoom to the x axis only.
- Parameters
key (
str
) – Default'x'
.
-
setup_scrollwheel_zooming
(scale=1.1)[source] Allow zooming of the chart with the scrollwheel.
- Parameters
scale (
float
) – Default1.1
.
clearable_textctrl
A TextCtrl with a button to clear its contents
Classes:
|
Text control used by |
|
Clear button for the |
|
TextCtrl with a button to clear its contents. |
Data:
XPM button icon for clearing the text control. |
-
class
CTCWidget
(parent, value, style, validator)[source] Bases:
TextCtrl
Text control used by
ClearableTextCtrl
.- Parameters
parent (
ClearableTextCtrl
) – The parent window.value (
str
) – The initial value of the text controlstyle (
int
) – The style of the text controlvalidator
Methods:
Returns the parent object.
OnText
(event)Event handler for text being entered in the control.
OnTextEnter
(_)Event handler for the enter / return ⏎ key being pressed
-
class
ClearButton
(parent, eventType, bmp)[source] Bases:
Control
Clear button for the
ClearableTextCtrl
.- Parameters
parent (
ClearableTextCtrl
) – The parent window.eventType (
PyEventBinder
)bmp (
Bitmap
)
Methods:
Always returns
False
.Returns the best size for the control.
Returns the parent object.
OnLeftUp
(_)Event Handler for left mouse button being released.
OnPaint
(_)Event Handler for widget being painted.
SetBitmapLabel
(label)Set bitmap for the button.
-
class
ClearableTextCtrl
(parent, id=-1, value='', pos=(-1, -1), size=(-1, -1), style=0, validator=<wx.Validator object>, name='ClearableTextCtrl')[source] Bases:
TextCtrlWrapper
,Panel
TextCtrl with a button to clear its contents.
- Parameters
parent (
Window
) – The parent window.id (
int
) – An identifier for the control.wx.ID_ANY
is taken to mean a default. Default-1
.value (
str
) – Default text value. Default''
.pos (
Point
) – The control position. The valuewx.DefaultPosition
indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.size (
Size
) – The control size. The value wx.DefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.style (
int
) – The window style. Seewx.TextCtrl
. Default0
.validator (
Validator
) – Window validator. Default<wx.Validator object at 0x7f21e9c88f10>
.name (
str
) – Window name. Default'ClearableTextCtrl'
.
Methods:
AutoComplete
(completer)Enable auto-completion using the provided completer object.
Call this function to enable auto-completion of the text using the file system directories.
Call this function to enable auto-completion of the text typed in a single-line text control using all valid file system paths.
ChangeValue
(value)Sets the new text control value.
Resets the internal modified flag as if the current changes had been saved.
EmulateKeyPress
(event)Inserts into the control the character which would have been inserted if the given key event had occurred in the text control.
Returns the best size for the control.
Returns a list of
wx.Window
objects that make up this control.Returns the style currently used for new text.
Returns the insertion point, or cursor, position.
GetLineLength
(lineNo)Gets the length of the specified line, not including any trailing newline character(s).
GetLineText
(lineNo)Returns the contents of a given line in the text control, not including any trailing newline character(s).
Returns the number of lines in the text control buffer.
GetRange
(from_, to_)Returns the string containing the text starting in the positions from and up to to in the control.
GetStyle
(position, style)Returns the style at this position in the text control.
HitTest
(pt)Finds the row and column of the character at the specified point.
HitTestPos
(pt)Finds the position of the character at the specified point.
Returns the clear button’s visibility state.
Returns whether the text has been modified by user.
Returns whether this is a multi line control.
Returns whether this is a single line control.
Lays out the child controls.
Mark the control as modified (dirty).
OnClearButton
(event)Event handler for clear button being pressed
OnSize
(event)Event handler for the size of the control being changed.
PositionToXY
(pos)Converts given position to a zero-based column, line number pair.
SetBackgroundColour
(colour)Sets the background colour of the control
SetClearBitmap
(bitmap)Sets the bitmap for the clear button.
SetDefaultStyle
(style)Changes the default style to use for the new text which is going to be added to the control.
SetEditable
(editable)Makes the text item editable or read-only, overriding the
wx.TE_READONLY
flag.SetFont
(font)Sets the font for the control.
SetInsertionPoint
(pos)Sets the insertion point at the given position.
Sets the insertion point at the end of the text control.
SetMaxLength
(length)This function sets the maximum number of characters the user can enter into the control.
SetModified
(modified)Marks the control as being modified by the user or not.
SetStyle
(start, end, style)Changes the style of the given range.
- rtype
ShowPosition
(pos)Makes the line containing the given position visible.
XYToPosition
(x, y)Converts the given zero-based column and line number to a position.
Attributes:
Returns the default clear button bitmap for the control.
-
AutoComplete
(completer)[source] Enable auto-completion using the provided completer object.
The specified completer object will be used to retrieve the list of possible completions for the already entered text and will be deleted by
wx.TextEntry
itself when it’s not needed any longer.- Parameters
completer (
TextCompleter
) – The object to be used for generating completions if notNone
. If it isNone
, auto-completion is disabled. Thewx.TextEntry
object takes ownership of this pointer and will delete it in any case (i.e. even if this method returnFalse
).- Return type
- Returns
True
if the auto-completion was enabled orFalse
if the operation failed, typically because auto-completion is not supported by the current platform.
-
AutoCompleteDirectories
()[source] Call this function to enable auto-completion of the text using the file system directories.
Unlike
AutoCompleteFileNames()
, which completes both file names and directories, this function only completes the directory names.Note
This function is only implemented in wxMSW port and does nothing under the other platforms.
-
AutoCompleteFileNames
()[source] Call this function to enable auto-completion of the text typed in a single-line text control using all valid file system paths.
Note
This function is only implemented in wxMSW port and does nothing under the other platforms.
-
ChangeValue
(value)[source] Sets the new text control value.
It also marks the control as not-modified which means that
IsModified()
would returnFalse
immediately after the call toChangeValue()
.The insertion point is set to the start of the control (i.e. position 0) by this function.
This functions does not generate the
wx.wxEVT_TEXT
event but otherwise is identical toSetValue()
.- Parameters
value (
str
) – The new value to set. It may contain newline characters if the text control is multiline.
-
EmulateKeyPress
(event)[source] Inserts into the control the character which would have been inserted if the given key event had occurred in the text control.
The event object should be the same as the one passed to
wx.EVT_KEY_DOWN
handler previously by wxWidgets.Note
This function doesn’t currently work correctly for all keys under any platform but MSW.
-
GetInsertionPoint
()[source] Returns the insertion point, or cursor, position.
This is defined as the zero based index of the character position to the right of the insertion point. For example, if the insertion point is at the end of the single-line text control, it is equal to
GetLastPosition()
.- Return type
-
GetLineLength
(lineNo)[source] Gets the length of the specified line, not including any trailing newline character(s).
-
GetLineText
(lineNo)[source] Returns the contents of a given line in the text control, not including any trailing newline character(s).
-
GetRange
(from_, to_)[source] Returns the string containing the text starting in the positions from and up to to in the control.
The positions must have been returned by another
wx.TextCtrl
method.Note
The positions in a multiline
wx.TextCtrl
do not correspond to the indices in the string returned by GetValue because of the different new line representations (CR
orCR LF
) and so this method should be used to obtain the correct results instead of extracting parts of the entire value. It may also be more efficient, especially if the control contains a lot of data.
-
GetStyle
(position, style)[source] Returns the style at this position in the text control.
Not all platforms support this function.
-
HitTest
(pt)[source] Finds the row and column of the character at the specified point.
If the return code is not
wx.TE_HT_UNKNOWN
the row and column of the character closest to this position are returned, otherwise the output parameters are not modified.Note
This function is currently only implemented in Univ, wxMSW and wxGTK ports and always returns
wx.TE_HT_UNKNOWN
in the other ports.NB: pt is in device coords (not adjusted for the client area origin nor scrolling).
- Parameters
pt
- Return type
TextCtrlHitTestResult
-
HitTestPos
(pt)[source] Finds the position of the character at the specified point.
If the return code is not
wx.TE_HT_UNKNOWN
the position of the character closest to this position is returned, otherwise the output parameter is not modified.Note
This function is currently only implemented in Univ, wxMSW and wxGTK ports and always returns
wx.TE_HT_UNKNOWN
in the other ports.- Parameters
pt
- Return type
wxTextCtrlHitTestResult
-
IsModified
()[source] Returns whether the text has been modified by user.
Note
Calling
SetValue()
doesn’t make the control modified.- Return type
-
OnClearButton
(event)[source] Event handler for clear button being pressed
- Parameters
event (
CommandEvent
)
-
OnSize
(event)[source] Event handler for the size of the control being changed.
- Parameters
event (
SizeEvent
)
-
SetBackgroundColour
(colour)[source] Sets the background colour of the control
- Parameters
colour (
Colour
) – The colour to be used as the background colour; passwx.NullColour
. to reset to the default colour.
Note
You may want to use
wx.SystemSettings.GetColour
to retrieve a suitable colour to use rather than setting an hard-coded one.
-
SetDefaultStyle
(style)[source] Changes the default style to use for the new text which is going to be added to the control.
This applies both to the text added programmatically using
WriteText()
orAppendText()
and to the text entered by the user interactively.If either of the font, foreground, or background colour is not set in style, the values of the previous default style are used for them. If the previous default style didn’t set them either then the global font or colours of the text control itself are used as fall back.
However, if the style parameter is the default
wx.TextAttr
, then the default style is just reset (instead of being combined with the new style which wouldn’t change it at all).
-
SetEditable
(editable)[source] Makes the text item editable or read-only, overriding the
wx.TE_READONLY
flag.
-
SetInsertionPoint
(pos)[source] Sets the insertion point at the given position.
- Parameters
pos (
int
) – Position to set, in the range from 0 toGetLastPosition()
inclusive.
-
SetInsertionPointEnd
()[source] Sets the insertion point at the end of the text control.
This is equivalent to calling
SetInsertionPoint()
withGetLastPosition()
as the argument.
-
SetMaxLength
(length)[source] This function sets the maximum number of characters the user can enter into the control.
In other words, it allows limiting the text value length to len not counting the terminating
NUL
character.If len is 0, the previously set max length limit, if any, is discarded, and the user may enter as much text as the underlying native text control widget supports (typically at least 32Kb).
If the user tries to enter more characters into the text control when it is already filled up to the maximal length, a
wx.wxEVT_TEXT_MAXLEN
event is sent to notify the program about it (giving it the possibility to show an explanatory message, for example) and the extra input is discarded.Note that in wxGTK this function may only be used with single line text controls.
- Parameters
length (
int
)
-
SetModified
(modified)[source] Marks the control as being modified by the user or not.
- Parameters
modified (
bool
)
-
SetStyle
(start, end, style)[source] Changes the style of the given range.
If any attribute within style is not set, the corresponding attribute from GetDefaultStyle is used.
-
ShowPosition
(pos)[source] Makes the line containing the given position visible.
- Parameters
pos (
int
) – The position that should be visible.
-
property
default_clear_bitmap
Returns the default clear button bitmap for the control.
- Return type
-
clear_btn
= [b'25 19 2 1', b' c None', b'+ c #000000', b' ', b' ', b' ', b' ', b' ', b' ', b' +++++++++++++ ', b' ++ + ', b' ++ + + + ', b' ++ + + + ', b' ++ + + ', b' ++ + + + ', b' ++ + + + ', b' ++ + ', b' +++++++++++++ ', b' ', b' ', b' ', b' ', b' '] -
XPM button icon for clearing the text control.
dialogs
Several dialog classes and helper functions for file/folder dialogs
Classes:
|
Alternative to wx.NumberEntryDialog that provides a TextCtrl which only allows numbers and decimal points to be entered. |
|
Alternative to wx.NumberEntryDialog that provides a TextCtrl which only allows numbers to be entered. |
Class to generate glob wildcards for wx.FileDialog |
Functions:
|
Create a wx.FileDialog with for the extension and filetypestring given, and return the filename selected. |
|
Create a |
|
Create a wx.FileDialog with the wildcard string given, and return a list of the files selected. |
-
class
FloatEntryDialog
(*args, **kwargs)[source] Bases:
TextEntryDialog
Alternative to wx.NumberEntryDialog that provides a TextCtrl which only allows numbers and decimal points to be entered.
Based on http://wxpython-users.1045709.n5.nabble.com/Adding-Validation-to-wx-TextEntryDialog-td2371082.html
Methods:
GetValue
()
-
class
IntEntryDialog
(*args, **kwargs)[source] Bases:
TextEntryDialog
Alternative to wx.NumberEntryDialog that provides a TextCtrl which only allows numbers to be entered.
Based on http://wxpython-users.1045709.n5.nabble.com/Adding-Validation-to-wx-TextEntryDialog-td2371082.html
Methods:
GetValue
()
-
class
Wildcards
[source] Bases:
object
Class to generate glob wildcards for wx.FileDialog
Methods:
__repr__
()Return repr(self).
__str__
()Return str(self).
add_all_files_wildcard
([hint_format])Add a wildcard for ‘All Files’.
add_common_filetype
(filetype[, hint_format, …])Add a common filetype.
add_filetype
(description[, extensions, …])Add a filetype to the wildcards
add_image_wildcard
([value_format])Add a wildcard for all image filetypes.
Attributes:
Returns a string representing the wildcards for use in wx.FileDialog or file_dialog_wildcards
-
add_common_filetype
(filetype, hint_format=8, value_format=12)[source] Add a common filetype.
- Parameters
Valid values for hint_format and value_format are style_uppercase, style_lowercase and style_hidden, which can be combined using the | operator.
-
add_filetype
(description, extensions=None, hint_format=8, value_format=12)[source] Add a filetype to the wildcards
- Parameters
Valid values for hint_format and value_format are style_uppercase, style_lowercase and style_hidden, which can be combined using the | operator.
-
-
file_dialog
(*args, **kwargs)[source] Create a wx.FileDialog with for the extension and filetypestring given, and return the filename selected.
-
file_dialog_multiple
(parent, extension, title, filetypestring, style=6, **kwargs)[source] Create a
wx.FileDialog
with the extension and filetypestring given, and return a list of the files selected.- Parameters
- Return type
- Returns
List of filenames for the selected files. If
wx.FD_MULTIPLE
is not in the style, the list will contain only one element.
editable_listbox
A Python implementation of wx.EditableListBox, a ListBox with editable items.
Available in two flavours:
Vanilla, that accepts any string value; and
- Numerical, that only accepts numerical values.
Those could be str, int, float or decimal.Decimal, but decimal.Decimal is used internally and is the type that will be returned.
Classes:
|
list control with auto-resizable column: |
|
This class provides a composite control that lets the user easily enter and edit a list of strings. |
|
|
-
class
CleverListCtrl
(parent, id=-1, pos=(-1, -1), size=(-1, -1), style=4, validator=<wx.Validator object>, name=b'listCtrl')[source] Bases:
ListCtrl
list control with auto-resizable column:
- Parameters
Methods:
OnSize
(event)- param event
The wxPython event.
-
class
EditableListBox
(parent, id=- 1, label='', pos=(- 1, - 1), size=(- 1, - 1), style=1792, name=b'editableListBox')[source] Bases:
Panel
This class provides a composite control that lets the user easily enter and edit a list of strings.
Styles supported:
wx.adv.EL_ALLOW_NEW
- Allow user to create new items.wx.adv.EL_ALLOW_EDIT
- Allow user to edit text in the control.wx.adv.EL_ALLOW_DELETE
- Allow user to delete text from the control.
- Parameters
Methods:
Retrieves a reference to the BitmapButton that is used as the ‘delete’ button in the control.
Retrieves a reference to the BitmapButton that is used as the ‘down’ button in the control.
Retrieves a reference to the BitmapButton that is used as the ‘edit’ button in the control.
Returns a reference to the actual list control portion of the custom control.
Retrieves a reference to the BitmapButton that is used as the ‘new’ button in the control.
Returns a list of the current contents of the control.
Retrieves a reference to the BitmapButton that is used as the ‘up’ button in the control.
OnBeginLabelEdit
(event)- param event
The wxPython event.
OnDelItem
(_)OnDownItem
(_)OnEditItem
(_)OnEndLabelEdit
(event)- param event
The wxPython event.
OnItemActivated
(evt)OnItemSelected
(event)OnNewItem
(event)- param event
The wxPython event.
OnUpItem
(_)SetStrings
(strings)Replaces current contents with given strings.
SwapItems
(i1, i2)- type i1
on_value_changed
(event)-
GetDelButton
()[source] Retrieves a reference to the BitmapButton that is used as the ‘delete’ button in the control.
-
GetDownButton
()[source] Retrieves a reference to the BitmapButton that is used as the ‘down’ button in the control.
-
GetEditButton
()[source] Retrieves a reference to the BitmapButton that is used as the ‘edit’ button in the control.
-
GetListCtrl
()[source] Returns a reference to the actual list control portion of the custom control.
- Returns
- Return type
-
GetNewButton
()[source] Retrieves a reference to the BitmapButton that is used as the ‘new’ button in the control.
-
GetStrings
()[source] Returns a list of the current contents of the control.
- Returns
list of strings
- Return type
list of str
-
GetUpButton
()[source] Retrieves a reference to the BitmapButton that is used as the ‘up’ button in the control.
-
class
EditableNumericalListBox
(parent, id=- 1, label='', decimal_places=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=1792, name=b'editableListBox')[source] Bases:
EditableListBox
- Parameters
Methods:
Returns a list of the current contents of the control.
Returns a list of the current contents of the control.
SetDecimalPlaces
(_decimal_places)SetStrings
(strings)Replaces current contents with given strings.
SetValues
(values)Replaces current contents with given values.
on_value_changed
(event)Attributes:
-
GetStrings
()[source] Returns a list of the current contents of the control.
- Returns
list of strings
- Return type
list of str
-
SetStrings
(strings)[source] Replaces current contents with given strings.
- Parameters
strings – list of strings.
-
property
decimal_places
events
Reusable code for simple events
Usage:
>>> from domdf_wxpython_tools import events
>>> # Create the event outside of the class
>>> myEVT = events.SimpleEvent()
>>> # Set the receiver to the class you want.
>>> # This is usually done from within the receiver class
>>> class MyClass(object):
... def __init__(self):
... myEVT.set_receiver(self)
...
... # Then bind the event to a handler
... myEVT.Bind(self.handler)
...
... def handler(self):
... '''Handler for myEVT'''
... pass
>>> # From within the thread, trigger the event with the following syntax:
>>> myEVT.trigger()
Classes:
|
Event containing a message payload. |
|
|
-
class
PayloadEvent
(etype, eid, value)[source] Bases:
PyCommandEvent
Event containing a message payload.
Methods:
GetValue
()Returns the value from the event.
-
class
SimpleEvent
(receiver=None, name='Event')[source] Bases:
object
- Parameters
receiver – Default
None
.name – Default
'Event'
.
Methods:
Bind
(handler[, receiver])Bind the event to the handler.
Unbind
([receiver])Unbind the event from the handler
__repr__
()Return a nicely formatted representation string.
set_receiver
(receiver)Set the class that is to receive the event trigger.
trigger
([value])Trigger the event
-
Bind
(handler, receiver=None, **kwargs)[source] Bind the event to the handler.
- Parameters
handler – handler to bind the event to.
kwargs – keyword arguments to pass through to receiver’s Bind method.
-
Unbind
(receiver=None, **kwargs)[source] Unbind the event from the handler
- Parameters
kwargs – keyword arguments to pass through to receiver’s Unbind method
filebrowsectrl
Classes:
|
|
|
A control to allow the user to type in a filename or browse with the standard file dialog to select file. |
|
with following additions: |
-
class
DirBrowseCtrl
(parent, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=537401408, labelText='Select a directory:', buttonText='Browse', toolTip='Type directory name or browse to select', dialogTitle='', initialValue=None, changeCallback=None, name='DirBrowseCtrl')[source] Bases:
FileBrowseCtrl
Methods:
OnBrowse
([ev])Going to browse for file…
Attributes:
-
class
FileBrowseCtrl
(parent, id=-1, pos=(-1, -1), size=(-1, -1), style=524289, labelText='File Entry:', buttonText='Browse', toolTip='Type a filename or click the browse button to choose a file', dialogTitle='Choose a file', initialValue='', changeCallback=<function '<lambda>'>, labelWidth=0, name='fileBrowseButton', show_cancel_btn=True, fileMask='All files (*.*)|*.*', dialog_title='File Picker', **kwargs)[source] Bases:
TextCtrlWrapper
,FileBrowseButton
A control to allow the user to type in a filename or browse with the standard file dialog to select file.
Based on and subclassed from wx.lib.filebrowsebutton.FileBrowseButton but with a wx.SearchCtrl in place of the wx.TextCtrl to provide the cancel/clear button and with an icon on the browse button.
- Parameters
id (
int
) – Control identifier. A value of-1
denotes a default value. Default-1
.pos (
Point
) – Control position. Default(-1, -1)
.size (
Size
) – Control size. Default(-1, -1)
.style (
int
) – Window style. See wx.Window and ClearableTextCtrl for supported styles. Default524289
.labelText (
str
) – Text for label to left of text field. Default'File Entry:'
.buttonText (
str
) – Text for button which launches the file dialog. Default'Browse'
.toolTip (
str
) – Help text. Default'Type a filename or click the browse button to choose a file'
.dialogTitle (
str
) – Title used in file dialog. Default'Choose a file'
.initialValue (
str
) – The initial value of the TextCtrl. Default''
.changeCallback – Optional callback called for all changes in value of the control. Default
domdf_wxpython_tools.filebrowsectrl.
.labelWidth – Width of the label. Default
0
.name – Default
'fileBrowseButton'
.show_cancel_btn (
bool
) – Whether to show or hide the cancel button. DefaultTrue
.dialog_title (
str
) – The title of the FileDialog. Default'File Picker'
.fileMask (
str
) – File mask (glob pattern, such as *.*) to use in file dialog. See wx.FileDialog for more information. Default'All files (*.*)|*.*'
.
Methods:
ChangeValue
(value)Sets the new text control value.
GetLabel
()Retrieve the label’s current text.
GetLineLength
(lineNo)Gets the length of the specified line, not including any trailing newline character(s).
GetLineText
(lineNo)Returns the contents of a given line in the text control, not including any trailing newline character(s).
Returns the number of lines in the text control buffer.
GetRange
(from_, to_)Returns the string containing the text starting in the positions from and up to in the control.
Returns
True
if the controls contents may be edited by user (note that it always can be changed by the program).Returns
True
if the text has been modified by user.Returns
True
if this is a multi line edit control andFalse
otherwise.Returns
True
if this is a single line edit control andFalse
otherwise.Mark text as modified (dirty).
OnBrowse
([event])Going to browse for file…
SetLabel
(value)Set the label’s current text.
SetModified
(modified)Marks the control as being modified by the user or not.
SetValue
(value[, callBack])Sets the new text control value.
Create the browse-button control.
Create the text control.
Attributes:
-
ChangeValue
(value)[source] Sets the new text control value.
It also marks the control as not-modified which means that IsModified() would return
False
immediately after the call to ChangeValue .The insertion point is set to the start of the control (i.e. position 0) by this function.
This functions does not generate the wxEVT_TEXT event but otherwise is identical to SetValue .
- Parameters
value (
str
) – The new value to set. It may contain newline characters if the text control is multi-line.
-
GetLineLength
(lineNo)[source] Gets the length of the specified line, not including any trailing newline character(s).
-
GetLineText
(lineNo)[source] Returns the contents of a given line in the text control, not including any trailing newline character(s).
-
GetNumberOfLines
()[source] Returns the number of lines in the text control buffer.
- Returns
- Return type
-
GetRange
(from_, to_)[source] Returns the string containing the text starting in the positions from and up to in the control.
The positions must have been returned by another wx.TextCtrl method.
-
IsEditable
()[source] Returns
True
if the controls contents may be edited by user (note that it always can be changed by the program).In other words, this functions returns
True
if the control hasn’t been put in read-only mode by a previous call to SetEditable .- Return type
-
IsModified
()[source] Returns
True
if the text has been modified by user.Note that calling SetValue doesn’t make the control modified.
- Returns
- Return type
-
IsMultiLine
()[source] Returns
True
if this is a multi line edit control andFalse
otherwise.- Returns
- Return type
-
IsSingleLine
()[source] Returns
True
if this is a single line edit control andFalse
otherwise.- Returns
- Return type
-
SetModified
(modified)[source] Marks the control as being modified by the user or not.
- Parameters
modified (
bool
)
-
SetValue
(value, callBack=1)[source] Sets the new text control value.
It also marks the control as not-modified which means that IsModified() would return
False
immediately after the call to SetValue .The insertion point is set to the start of the control (i.e. position 0) by this function unless the control value doesn’t change at all, in which case the insertion point is left at its original position.
Note that, unlike most other functions changing the controls values, this function generates a wxEVT_TEXT event. To avoid this you can use ChangeValue instead.
Parameters: value (string) – The new value to set. It may contain newline characters if the text control is multi-line.
-
class
FileBrowseCtrlWithHistory
(*arguments, **namedarguments)[source] Bases:
FileBrowseCtrl
- with following additions:
__init__(…, history=None)
- history – optional list of paths for initial history drop-down
(must be passed by name, not a positional argument) If history is callable it will must return a list used for the history drop-down
- changeCallback – as for FileBrowseCtrl, but with a work-around
for win32 systems which don’t appear to create wx.EVT_COMBOBOX events properly. There is a (slight) chance that this work-around will cause some systems to create two events for each Combobox selection. If you discover this condition, please report it!
As for a FileBrowseCtrl.__init__ otherwise.
- GetHistoryControl()
Return reference to the control which implements interfaces required for manipulating the history list. See GetHistoryControl documentation for description of what that interface is.
- GetHistory()
Return current history list
- SetHistory( value=(), selectionIndex = None )
Set current history list, if selectionIndex is not
None
, select that index
Methods:
Return the current history list
Return a pointer to the control which provides (at least) the following methods for manipulating the history list:
OnSetFocus
(event)When the history scroll is selected, update the history
SetHistory
([value, selectionIndex, control])Set the current history list
Create the text control.
Attributes:
-
GetHistoryControl
()[source] Return a pointer to the control which provides (at least) the following methods for manipulating the history list:
Append( item ) – add item Clear() – clear all items Delete( index ) – 0-based index to delete from list SetSelection( index ) – 0-based index to select in list
Semantics of the methods follow those for the wxComboBox control
icons
Functions:
|
Get a stock bitmap from its wx.ART_xxx ID |
|
|
|
|
|
imagepanel
Based on ChartPanelBase, a canvas for displaying an image within a wxPython window using PIL and matplotlib, with a right click menu with some basic options
Classes:
|
Custom Event for an image in the ImagePanel being changed. |
|
Panel that contains a matplotlib plotting window, used for displaying an image. |
-
class
EvtImgPanelChanged
(windowID, obj)[source] Bases:
PyCommandEvent
Custom Event for an image in the ImagePanel being changed.
- Parameters
windowID (
int
)obj
Attributes:
-
class
ImagePanel
(parent, image=None, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=0, name=b'panel')[source] Bases:
ChartPanelBase
Panel that contains a matplotlib plotting window, used for displaying an image. The image can be right clicked to bring up a context menu allowing copying, pasting and saving of the image. The image can be panned by holding the left mouse button and moving the mouse, and zoomed in and out using the scrollwheel on the mouse.
- Parameters
parent (
Window
) – The parent window.image – Default
None
.id (
int
) – An identifier for the panel. wx.ID_ANY is taken to mean a default. Default-1
.pos (
Point
) – The panel position. The valuewx.DefaultPosition
indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.size (
Size
) – The panel size. The value ::wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.style (
int
) – The window style. See wxPanel. Default0
.name (
str
) – Window name. Defaultb'panel'
.
Methods:
clear
([event])Clear the image from the control
copy
([_])Copy the image to the clipboard.
load_image
([new_image, suppress_event])Load the ‘new_image’ into the control.
on_context_menu
(event)Event Handler for bringing up right click context menu
on_load
([event])Load the image into the dialog from the file selected in the dialog
on_save
([event])Save the image to the location selected in the dialog
paste
([event])Paste the image from the clipboard into the control.
reset_view
(*_)Reset the view of the image.
Attributes:
Returns the image being displayed in the control
-
property
image
Returns the image being displayed in the control
- Return type
Event Handler for bringing up right click context menu
list_dialog
Classes:
|
A dialog containing a |
-
class
list_dialog
(parent, id=- 1, title='Choose', label='Choose: ', choices=None, pos=(- 1, - 1), size=(- 1, - 1), style=536877056, name=b'dialog')[source] Bases:
Dialog
A dialog containing a
wx.ListBox
.- Parameters
parent (
Window
) – The parent window. Can be None, a frame or another dialog boxid (
int
) – An identifier for the dialog.wx.ID_ANY
is taken to mean a default. Default-1
.title (
str
) – The title of the dialog. Default'Choose'
.label (
str
) – The label for thewx.ListBox
. Default'Choose: '
.choices (
Optional
[List
[str
]]) – A list of choices for the wx.ListBox. DefaultNone
.pos (
Point
) – The dialog position. The valuewx.DefaultPosition
indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.size (
Size
) – The dialog size. The value ::wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.style (
int
) – The window style. See wxPanel. Default536877056
.name (
str
) – Window name. Defaultb'dialog'
.
Methods:
do_cancel
(_)Event Handler for dialog being cancelled
do_select
(_)Event Handler for item in list being selected
logctrl
Log Control, supporting text copying and zoom.
Classes:
|
Log Window based on StyledTextCtrl. |
-
class
LogCtrl
(parent, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=138412032, name='Log')[source] Bases:
StyledTextCtrl
Log Window based on StyledTextCtrl.
- Parameters
parent (
Window
) – The parent window.id (
int
) – An identifier for the Log window. wx.ID_ANY is taken to mean a default. Default-1
.pos (
Point
) – The Log window position. The valuewx.DefaultPosition
indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.size (
Size
) – The Log window size. The value ::wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. Default(-1, -1)
.style (
int
) – The window style. See wxPanel. Default138412032
.name (
str
) – Window name. Default'Log'
.
Methods:
Append
(text[, c])Add the text to the end of the control using colour c which should be suitable for feeding directly to wx.NamedColour.
AppendStderr
(text)Add the stderr text to the end of the control using colour “red”
CanCopy
()Returns
True
if text is selected and can be copied,False
otherwise.Copy
()Copy the selection and place it on the clipboard.
DoFindNext
(findData[, findDlg])Create and return a context menu for the log.
GetRange
(start, end)vent Handler for showing the context menu
OnFindClose
(_)OnFindText
(*_)OnZoomDefault
(*_)Event Handler for resetting the zoom
OnZoomIn
(*_)Event Handler for zooming in
OnZoomOut
(*_)Event Handler for zooming out
ShowPosition
(pos)ToggleWrap
(*_)Toggle word wrap.
fixLineEndings
(text)Return text with line endings replaced by OS-specific endings.
getStyle
([c])Returns a style for a given colour if one exists.
onKeyPress
(event)Event Handler for key being pressed.
setDisplayLineNumbers
(state)setStyles
(faces)Configure font size, typeface and color for lexer.
wrap
([wrap])Set whether text is word wrapped.
write
(text)Display text in the log.
Attributes:
-
Append
(text, c=None)[source] Add the text to the end of the control using colour c which should be suitable for feeding directly to wx.NamedColour.
- Parameters
text – … Should be a unicode string or contain only ascii data.
c – Default
None
.
-
AppendStderr
(text)[source] Add the stderr text to the end of the control using colour “red”
- Parameters
text – … Should be a unicode string or contain only ascii data.
-
GetContextMenu
()[source] Create and return a context menu for the log. This is used instead of the scintilla default menu in order to correctly respect our immutable buffer.
-
findDlg
Type:
Optional
[FindReplaceDialog
]
-
fixLineEndings
(text)[source] Return text with line endings replaced by OS-specific endings.
- Parameters
text
-
getStyle
(c='black')[source] Returns a style for a given colour if one exists.
If no style exists for the colour, make a new style.
If we run out of styles, (only 32 allowed here) we go to the top of the list and reuse previous styles.
- Parameters
c (
str
) – Default'black'
.
picker
Classes:
|
|
|
|
|
|
-
class
dir_picker
(parent, id=- 1, value='', pos=(- 1, - 1), size=(- 1, - 1), style=524288, name=b'dir_picker')[source] Bases:
TextCtrlWrapper
,Panel
- Parameters
Methods:
Browse
(*_)Clear
(*_)Clears the text in the control.
Returns the insertion point, or cursor, position.
Resets the text ctrl to the initial value, either specified in __init__ or set with
SetInitialValue
.SetHeight
(height)Set the height of the widgets
SetInitialValue
(value)Sets the initial value for the text ctrl.
SetInsertionPoint
(pos)Sets the insertion point at the given position.
Sets the insertion point at the end of the text control.
SetTextWidth
(width)Sets the width of the TextCtrl.
set_height
(height)set_textctrl_width
(width)Attributes:
-
Clear
(*_)[source] Clears the text in the control.
Note that this function will generate a wxEVT_TEXT event, i.e. its effect is identical to calling SetValue (“”).
-
GetInsertionPoint
()[source] Returns the insertion point, or cursor, position.
This is defined as the zero based index of the character position to the right of the insertion point. For example, if the insertion point is at the end of the single-line text control, it is equal to GetLastPosition .
- Return type
long
-
ResetValue
()[source] Resets the text ctrl to the initial value, either specified in __init__ or set with
SetInitialValue
.
-
SetHeight
(height)[source] Set the height of the widgets
- Parameters
height (
int
) – Height of the widgets
-
SetInitialValue
(value)[source] Sets the initial value for the text ctrl.
- Parameters
value (
str
) – Initial value for the text ctrl.
-
SetInsertionPoint
(pos)[source] Sets the insertion point at the given position.
- Parameters
pos (
int
) – Position to set, in the range from0
toGetLastPosition()
inclusive.
-
SetInsertionPointEnd
()[source] Sets the insertion point at the end of the text control.
This is equivalent to calling wx.TextCtrl.SetInsertionPoint with wx.TextCtrl.GetLastPosition argument.
-
class
file_folder_picker
(parent, id=- 1, value='', pos=(- 1, - 1), size=(- 1, - 1), style=524294, name=b'file_picker', extension='*', title='File Picker', filetypestring='All Files', start_as_files=True, **kwargs)[source] Bases:
dir_picker
- Parameters
Methods:
Browse
(*_)Attributes:
-
class
file_picker
(parent, id=- 1, value='', pos=(- 1, - 1), size=(- 1, - 1), style=524294, name=b'file_picker', extension='*', title='File Picker', filetypestring='All Files', **kwargs)[source] Bases:
dir_picker
- Parameters
Methods:
Browse
(*_)Attributes:
projections
Classes:
|
Prevent zooming in pan mode. |
|
Constrain pan to x-axis. |
|
Constrain pan to x-axis and prevent zooming. |
-
class
NoZoom
(fig, *args, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, box_aspect=None, **kwargs)[source] Bases:
Axes
Prevent zooming in pan mode.
Methods:
drag_pan
(button, key, x, y)- param button
The pressed mouse button.
set
(*[, adjustable, agg_filter, alpha, …])Set multiple properties at once.
Attributes:
-
set
(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, subplotspec=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>) Set multiple properties at once.
Supported properties are
- Properties:
adjustable: {‘box’, ‘datalim’} agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None anchor: (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} animated: bool aspect: {‘auto’, ‘equal’} or float autoscale_on: bool autoscalex_on: unknown autoscaley_on: unknown axes_locator: Callable[[Axes, Renderer], Bbox] axisbelow: bool or ‘line’ box_aspect: float or None clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None facecolor or fc: color figure: ~matplotlib.figure.Figure frame_on: bool gid: str in_layout: bool label: object mouseover: bool navigate: bool navigate_mode: unknown path_effects: list of .AbstractPathEffect picker: None or bool or float or callable position: [left, bottom, width, height] or ~matplotlib.transforms.Bbox prop_cycle: ~cycler.Cycler rasterization_zorder: float or None rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None subplotspec: unknown title: str transform: ~matplotlib.transforms.Transform url: str visible: bool xbound: (lower: float, upper: float) xlabel: str xlim: (left: float, right: float) xmargin: float greater than -0.5 xscale: unknown xticklabels: unknown xticks: unknown ybound: (lower: float, upper: float) ylabel: str ylim: (bottom: float, top: float) ymargin: float greater than -0.5 yscale: unknown yticklabels: unknown yticks: unknown zorder: float
-
class
XPanAxes
(fig, *args, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, box_aspect=None, **kwargs)[source] Bases:
Axes
Constrain pan to x-axis.
Methods:
drag_pan
(button, key, x, y)- param button
The pressed mouse button.
set
(*[, adjustable, agg_filter, alpha, …])Set multiple properties at once.
Attributes:
-
set
(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, subplotspec=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>) Set multiple properties at once.
Supported properties are
- Properties:
adjustable: {‘box’, ‘datalim’} agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None anchor: (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} animated: bool aspect: {‘auto’, ‘equal’} or float autoscale_on: bool autoscalex_on: unknown autoscaley_on: unknown axes_locator: Callable[[Axes, Renderer], Bbox] axisbelow: bool or ‘line’ box_aspect: float or None clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None facecolor or fc: color figure: ~matplotlib.figure.Figure frame_on: bool gid: str in_layout: bool label: object mouseover: bool navigate: bool navigate_mode: unknown path_effects: list of .AbstractPathEffect picker: None or bool or float or callable position: [left, bottom, width, height] or ~matplotlib.transforms.Bbox prop_cycle: ~cycler.Cycler rasterization_zorder: float or None rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None subplotspec: unknown title: str transform: ~matplotlib.transforms.Transform url: str visible: bool xbound: (lower: float, upper: float) xlabel: str xlim: (left: float, right: float) xmargin: float greater than -0.5 xscale: unknown xticklabels: unknown xticks: unknown ybound: (lower: float, upper: float) ylabel: str ylim: (bottom: float, top: float) ymargin: float greater than -0.5 yscale: unknown yticklabels: unknown yticks: unknown zorder: float
-
class
XPanAxes_NoZoom
(fig, *args, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, box_aspect=None, **kwargs)[source] Bases:
Axes
Constrain pan to x-axis and prevent zooming.
Methods:
drag_pan
(button, key, x, y)- param button
The pressed mouse button.
set
(*[, adjustable, agg_filter, alpha, …])Set multiple properties at once.
Attributes:
-
set
(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, subplotspec=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>) Set multiple properties at once.
Supported properties are
- Properties:
adjustable: {‘box’, ‘datalim’} agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None anchor: (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} animated: bool aspect: {‘auto’, ‘equal’} or float autoscale_on: bool autoscalex_on: unknown autoscaley_on: unknown axes_locator: Callable[[Axes, Renderer], Bbox] axisbelow: bool or ‘line’ box_aspect: float or None clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None facecolor or fc: color figure: ~matplotlib.figure.Figure frame_on: bool gid: str in_layout: bool label: object mouseover: bool navigate: bool navigate_mode: unknown path_effects: list of .AbstractPathEffect picker: None or bool or float or callable position: [left, bottom, width, height] or ~matplotlib.transforms.Bbox prop_cycle: ~cycler.Cycler rasterization_zorder: float or None rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None subplotspec: unknown title: str transform: ~matplotlib.transforms.Transform url: str visible: bool xbound: (lower: float, upper: float) xlabel: str xlim: (left: float, right: float) xmargin: float greater than -0.5 xscale: unknown xticklabels: unknown xticks: unknown ybound: (lower: float, upper: float) ylabel: str ylim: (bottom: float, top: float) ymargin: float greater than -0.5 yscale: unknown yticklabels: unknown yticks: unknown zorder: float
style_picker
Dialogs for choosing Matplotlib colours and styles.
Classes:
|
Dialog for choosing Matplotlib colours. |
|
Dialog for choosing Matplotlib marker styles. |
-
class
ColourPicker
(parent, title='Choose Colours', label='Choose Colours: ', picker_choices=None, selection_choices=None, *args, **kwds)[source] Bases:
StylePicker
Dialog for choosing Matplotlib colours.
- Parameters
Methods:
apply
(event)Called when the user presses the Apply button.
-
class
StylePicker
(parent, title='Choose Styles', label='Choose Styles: ', selection_choices=None, *args, **kwds)[source] Bases:
Dialog
Dialog for choosing Matplotlib marker styles.
- Parameters
Methods:
apply
(event)Called when the user presses the Apply button.
cancel
(_)Called when the user presses the Cancel button.
tabbable_textctrl
Multiline wx.TextCtrl that allows tabbing to the next or previous control.
Classes:
|
Multiline |
-
class
TabbableTextCtrl
(parent, id=-1, value='', pos=(-1, -1), size=(-1, -1), style=0, validator=<wx.Validator object>, name=b'text')[source] Bases:
TextCtrl
Multiline
wx.TextCtrl
that allows tabbing to the next or previous control.- Parameters
id (
int
) – Control identifier. A value of-1
denotes a default value. Default-1
.value (
str
) – Default text value. Default''
.pos (
Point
) – Text control position. Default(-1, -1)
.size (
Size
) – Text control size. Default(-1, -1)
.style (
int
) – Window style. Seewx.TextCtrl
. Default0
.validator (
Validator
) – Window validator. Defaultwx.DefaultValidator
.name (
AnyStr
) – Window name. Defaultb'text'
.
Methods:
on_char
(event)Event handler for key being pressed, to allow for navigating between controls with TAB.
textctrlwrapper
Classes:
Base class for wrappers around |
-
class
TextCtrlWrapper
[source] Bases:
object
Base class for wrappers around
wx.TextCtrl
.Subclasses must set the value of
textctrl
.Methods:
AppendText
(text)Appends the given text to the end of the text control.
CanCopy
()Returns
True
if the selection can be copied to the clipboard.CanCut
()Returns
True
if the selection can be cut to the clipboard.CanPaste
()Returns
True
if the contents of the clipboard can be pasted into the text control.CanRedo
()Returns
True
if there is a redo facility available, and the last operation can be redone.CanUndo
()Returns
True
if there is an undo facility available, and the last operation can be undone.Clear
()Clears the text in the control.
Copy
()Copies the selected text to the clipboard.
Cut
()Copies the selected text to the clipboard and removes it from the control.
Returns the zero based index of the last position in the text control, which is equal to the number of characters in the control.
Gets the current selection span.
Returns the text currently selected in the control.
GetValue
()Gets the contents of the control.
Returns
True
if the controls contents may be edited by user (note that it always can be changed by the program).IsEmpty
()Returns whether the control is currently empty.
Paste
()Pastes the clipboard contents into the control.
Redo
()If there is a redo facility and the last operation can be redone, redoes the last operation.
Remove
(from_, to_)Removes the text starting at the first given position up to (but not including) the character at the last position.
Replace
(from_, to_, value)Replaces the text starting at the first position up to (but not including) the character at the last position with the given text.
Selects all text in the control.
Deselects selected text in the control.
SetSelection
(from_, to_)Selects the text starting at the first position up to (but not including) the character at the last position.
SetValue
(value)Sets the new text control value.
Undo
()If there is an undo facility, and the last operation can be undone, undoes the last operation.
WriteText
(text)Writes the text into the text control at the current insertion position.
Attributes:
The
wx.TextCtrl
being wrapped.-
AppendText
(text)[source] Appends the given text to the end of the text control.
Note
After the text is appended, the insertion point will be at the end of the text control. If this behaviour is not desired, the programmer should use GetInsertionPoint and SetInsertionPoint.
- Parameters
text (
str
)
-
CanPaste
()[source] Returns
True
if the contents of the clipboard can be pasted into the text control.On some platforms (Motif, GTK) this is an approximation and returns
True
if the control is editable,False
otherwise.- Return type
-
CanRedo
()[source] Returns
True
if there is a redo facility available, and the last operation can be redone.- Return type
-
CanUndo
()[source] Returns
True
if there is an undo facility available, and the last operation can be undone.- Return type
-
Clear
()[source] Clears the text in the control.
Note that this function will generate a
wx.wxEVT_TEXT
event, i.e. its effect is identical to callingSetValue('')
.
-
GetLastPosition
()[source] Returns the zero based index of the last position in the text control, which is equal to the number of characters in the control.
- Return type
wx.TextPos
-
GetSelection
()[source] Gets the current selection span.
If the returned values are equal, there was no selection.
Note
The indices returned may be used with the other
wx.TextCtrl
methods but don’t necessarily represent the correct indices into the string returned by GetValue for multiline controls under Windows (at least,) you should use GetStringSelection to get the selected text.
-
GetStringSelection
()[source] Returns the text currently selected in the control.
If there is no selection, the returned string is empty.
- Return type
-
GetValue
()[source] Gets the contents of the control.
Note
For a multiline text control, the lines will be separated by (Unix-style)
\n
characters, even under Windows where they are separated by a\r\n
sequence in the native control.- Return type
-
IsEditable
()[source] Returns
True
if the controls contents may be edited by user (note that it always can be changed by the program).In other words, this functions returns
True
if the control hasn’t been put in read-only mode by a previous call toSetEditable()
.- Return type
-
Redo
()[source] If there is a redo facility and the last operation can be redone, redoes the last operation.
Does nothing if there is no redo facility.
-
Remove
(from_, to_)[source] Removes the text starting at the first given position up to (but not including) the character at the last position.
This function puts the current insertion point position at to as a side effect.
-
Replace
(from_, to_, value)[source] Replaces the text starting at the first position up to (but not including) the character at the last position with the given text.
This function puts the current insertion point position at to as a side effect.
-
SetSelection
(from_, to_)[source] Selects the text starting at the first position up to (but not including) the character at the last position.
If both parameters are equal to -1 all text in the control is selected.
Notice that the insertion point will be moved to from by this function.
-
SetValue
(value)[source] Sets the new text control value.
It also marks the control as not-modified which means that
IsModified()
would returnFalse
immediately after the call toSetValue()
.The insertion point is set to the start of the control (i.e. position 0) by this function unless the control value doesn’t change at all, in which case the insertion point is left at its original position.
Note
Unlike most other functions changing the control’s values, this function generates a
wx.wxEVT_TEXT
event. To avoid this you can useChangeValue()
instead.- Parameters
value (
str
) – The new value to set. It may contain newline characters if the text control is multiline.
-
Undo
()[source] If there is an undo facility, and the last operation can be undone, undoes the last operation.
Does nothing if there is no undo facility.
-
WriteText
(text)[source] Writes the text into the text control at the current insertion position.
- Parameters
text (
str
) – Text to write to the text control
-
textctrl
Type:
TextCtrl
The
wx.TextCtrl
being wrapped.
-
timer_thread
Background thread that sends an event after the specified interval.
Useful for timeouts or updating timers, clocks etc.
Classes:
|
Background Timer Class. |
Data:
An instance of |
-
class
Timer
(parent, interval=1.0)[source] Bases:
Thread
Background Timer Class.
- Parameters
Methods:
join
([timeout])Stop the thread and wait for it to end.
run
()Run the timer thread.
-
timer_event
= SimpleEvent(name=Timer) Type:
SimpleEvent
An instance of
domdf_python_tools.events.SimpleEvent
called Timer.This event is triggered when the timer has expired.
utils
General utility functions.
Functions:
|
Constructs the label to display on a collapsible section. |
|
Displays a message box informing the user that the desired feature has not been implemented. |
Returns a platform dependent set of typefaces. |
|
|
Toggle value of the given control. |
-
collapse_label
(text, collapsed=True)[source] Constructs the label to display on a collapsible section.
validators
Various validator classes
Classes:
|
A Validator that only allows the type of characters selected to be entered. |
|
A Validator that only allows numbers and decimal points to be entered. |
Base class for Validators. |
-
class
CharValidator
(flag)[source] Bases:
ValidatorBase
A Validator that only allows the type of characters selected to be entered.
The possible flags are:
int-only - only the numbers
0123456789
can be entered.float-only - only numbers and decimal points can be entered.
Methods:
Clone
()Clones the
CharValidator
.OnChar
(event)Event handler for text being entered in the control.
Validate
(win)Validate the control.
-
Clone
()[source] Clones the
CharValidator
.
-
class
FloatValidator
(flag)[source] Bases:
CharValidator
A Validator that only allows numbers and decimal points to be entered. If a decimal point has already been entered, a second one cannot be entered. The argument flag is used to limit the number of decimal places that can be entered.
Methods:
OnChar
(event)Event handler for text being entered in the control.
-
class
ValidatorBase
[source] Bases:
Validator
Base class for Validators.
Methods:
Clone
()Clones the
wx.Validator
.Transfer data from window to validator.
Transfer data from validator to window.
Resets the control’s background colour.
Set the control’s background colour to pink.
-
Clone
()[source] Clones the
wx.Validator
.
-
TransferFromWindow
()[source] Transfer data from window to validator.
The default implementation returns
False
, indicating that an error occurred. We simply returnTrue
, as we don’t do any data transfer.- Return type
-
panel_listctrl
constants
Constants for panel_listctrl
.
css_parser
Functions:
|
Parse the stylesheet from the given string |
|
Parse the stylesheet in the given file. |
font_parser
Functions:
|
Makes a mutable dictionary immutable, so it can be used as an argument for |
|
Parse the font from the |
-
freezeargs
(func)[source] Makes a mutable dictionary immutable, so it can be used as an argument for
slru_cache()
.- Return type
-
parse_font
(style_dict)[source] Parse the font from the
style_dict
.- Parameters
style_dict (
Dict
) – Dictionary containing styling information for the font- Return type
- Returns
Tuple containing the colour of the font, and the font properties
The font properties dictionary returned will contain the following keys:
family (
wx.FontFamily
) – The font family: a generic portable way of referring to fonts without specifying a facename. This parameter must be one of the wx.FontFamily enumeration values. If the faceName argument is provided, then it overrides the font family.style (
wx.FontStyle
) – One ofwx.FONTSTYLE_NORMAL
,wx.FONTSTYLE_SLANT
andwx.FONTSTYLE_ITALIC
.weight (
wx.FontWeight
) – Font weight, sometimes also referred to as font boldness. One of the wx.FontWeight enumeration values.underline (
wx.bool
) – The value can beTrue
orFalse
. At present this has an effect on Windows and Motif 2.x only.faceName (
str) –
An optional string specifying the face name to be used. If it is an empty string, a default face name will be chosen based on the family.encoding (
wx.FontEncoding
) – An encoding which may be one of the enumeration values of wx.FontEncoding. If the specified encoding isn’t available, no font is created (see also Font Encodings).
and one of:
pointSize (
int
) – Size in points. See SetPointSize for more info. Notice that, for historical reasons, the value 70 here is interpreted at DEFAULT and results in creation of the font with the default size and not of a font with the size of 70pt. If you really need the latter, please use SetPointSize(70). Note that this constructor and the matching Create() method overload are the only places in wx.Font API handling DEFAULT specially: neither SetPointSize nor the constructor taking wx.FontInfo handle this value in this way.pixelSize (
wx.Size
) – Size in pixels. See SetPixelSize for more info.
depending on the font size specified in ‘style_dict’
panel_listctrl
A custom Panel that acts as a ListCtrl for other wx.Panel objects.
An example ListItem exists that provides two StaticText fields and can be used as the basis for custom list items
Classes:
|
|
|
|
-
class
PanelListCtrl
(parent, id=- 1, pos=(- 1, - 1), size=(- 1, - 1), style=524288, name=b'panel', left_padding=32)[source] Bases:
ScrolledWindow
Methods:
Append
(panel_list_item)Append a ‘PanelListItem’ object, or an instance of a custom subclass, to the control.
AppendNewItem
(text_dict, style_data)Append a new ‘PanelListItem’ object to the control, passing the ‘text_dict’ and ‘style_data’ parameters to the new object.
Clear
()Removes all items from the control
DeleteItem
(item)Deletes the specified item from the control.
Deselect all items.
Focus
(idx)Set Focus to the the given item.
Returns the number of columns.
GetFirstSelected
(*_)Returns the first selected item, or -1 when none is selected.
Gets the currently focused item or -1 if none is focused.
GetItem
(itemIdx, *_)Returns information about the item.
GetItemBackgroundColour
(item)Returns the colour for this item.
Returns the number of items in the list control.
GetItemPosition
(item)Returns the position of the item, or
-1
if it is not found.GetNextSelected
(item)Returns subsequent selected items, or -1 when no more are selected.
Returns the number of selected items in the list control.
IsEmpty
()Returns true if the control doesn’t currently contain any items.
IsSelected
(idx)Returns
:py:obj:`True`
if the item is selected.RefreshItem
(item)Redraws the given item.
RefreshItems
(itemFrom, itemTo)Redraws the items between itemFrom and itemTo.
Select
(idx[, on])Selects/deselects an item.
SetSelection
(idx)Set the current selection to the item at the given index.
Attributes:
Returns the number of columns.
Gets the currently focused item or -1 if none is focused.
Returns the number of items in the list control.
-
Append
(panel_list_item)[source] Append a ‘PanelListItem’ object, or an instance of a custom subclass, to the control.
-
AppendNewItem
(text_dict, style_data)[source] Append a new ‘PanelListItem’ object to the control, passing the ‘text_dict’ and ‘style_data’ parameters to the new object.
- Parameters
text_dict (
Dict
)style_data
- Return type
- Returns
The new PanelListItem object that was added to the control
-
property
FocusedItem
Gets the currently focused item or -1 if none is focused.
- Returns
- Return type
-
GetFirstSelected
(*_)[source] Returns the first selected item, or -1 when none is selected.
- Return type
-
GetFocusedItem
()[source] Gets the currently focused item or -1 if none is focused.
- Returns
- Return type
-
GetItem
(itemIdx, *_)[source] Returns information about the item. See
SetItem()
for more information.- Parameters
itemIdx
-
GetItemPosition
(item)[source] Returns the position of the item, or
-1
if it is not found.- Return type
-
GetNextSelected
(item)[source] Returns subsequent selected items, or -1 when no more are selected.
- Parameters
item
-
GetSelectedItemCount
()[source] Returns the number of selected items in the list control.
- Return type
-
IsEmpty
()[source] Returns true if the control doesn’t currently contain any items.
- Returns
- Return type
-
-
class
PanelListItem
(parent, text_dict, style_data, id=- 1, style=0, name=b'panel', left_padding=32)[source] Bases:
Panel
- Parameters
parent (
PanelListCtrl
) – The PanelListCtrl the item is to go intotext_dict (
Dict
)style_data
id (
int
) – An identifier for the panel. ID_ANY is taken to mean a default. Default-1
.style (
int
) – The window style. See wx.Panel. Default0
.name (
str
) – Window name. Defaultb'panel'
.left_padding (
int
) – the spacing to the left of the text in the control. Default32
.
Methods:
Returns the current background colour of the :class`wx.Panel` class.
Returns whether the
PanelListItem
is selected.OnClick
(_)OnKeyDown
(event)- param event
The wxPython event.
OnRightClick
(_)Refresh
(**kwargs)SelectItem
([select])Select (or deselect) the given item.
SetBackgroundColour
(colour)Set the background colour for the item.
SetSelectedBackgroundColour
(colour)Set the background colour for the item when it is selected.
-
GetCurrentBackgroundColour
()[source] Returns the current background colour of the :class`wx.Panel` class.
-
IsSelected
()[source] Returns whether the
PanelListItem
is selected.- Return type
Overview
domdf_wxpython_tools
uses tox to automate testing and packaging,
and pre-commit to maintain code quality.
Install pre-commit
with pip
and install the git hook:
python -m pip install pre-commit
pre-commit install
Coding style
formate is used for code formatting.
It can be run manually via pre-commit
:
pre-commit run formate -a
Or, to run the complete autoformatting suite:
pre-commit run -a
Automated tests
Tests are run with tox
and pytest
.
To run tests for a specific Python version, such as Python 3.6:
tox -e py36
To run tests for all Python versions, simply run:
tox
Build documentation locally
The documentation is powered by Sphinx. A local copy of the documentation can be built with tox
:
tox -e docs
Downloading source code
The domdf_wxpython_tools
source code is available on GitHub,
and can be accessed from the following URL: https://github.com/domdfcoding/domdf_wxpython_tools
If you have git
installed, you can clone the repository with the following command:
git clone https://github.com/domdfcoding/domdf_wxpython_tools
Cloning into 'domdf_wxpython_tools'...
remote: Enumerating objects: 47, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 173 (delta 16), reused 17 (delta 6), pack-reused 126
Receiving objects: 100% (173/173), 126.56 KiB | 678.00 KiB/s, done.
Resolving deltas: 100% (66/66), done.

Downloading a ‘zip’ file of the source code
Building from source
The recommended way to build domdf_wxpython_tools
is to use tox:
tox -e build
The source and wheel distributions will be in the directory dist
.
If you wish, you may also use pep517.build or another PEP 517-compatible build tool.
View the Function Index or browse the Source Code.