This control allows the user to select a font.
The generic implementation is a button which brings up a FontDialog when clicked. Native implementation may differ but this is usually a (small) widget which give access to the font-chooser dialog. It is only available if USE_FONTPICKERCTRL is set to 1 (the default).
This class supports the following styles:
FNTP_DEFAULT_STYLE: The default style: FNTP_FONTDESC_AS_LABEL | FNTP_USEFONT_FOR_LABEL.
FNTP_USE_TEXTCTRL: Creates a text control to the left of the picker button which is completely managed by the FontPickerCtrl and which can be used by the user to specify a font (see SetSelectedFont). The text control is automatically synchronized with button’s value. Use functions defined in PickerBase to modify the text control.
size 10” from the fontdialog, will update the label (overwriting any previous label) with the “Times New Roman, 10” text.
FNTP_USEFONT_FOR_LABEL: Uses the currently selected font to draw the label of the button.
Handlers bound for the following event types will receive a FontPickerEvent parameter.
See also
FontDialog, FontPickerEvent
__init__ | |
Create | Creates this widget with given parameters. |
GetMaxPointSize | Returns the maximum point size value allowed for the user-chosen font. |
GetSelectedFont | Returns the currently selected font. |
SetMaxPointSize | Sets the maximum point size value allowed for the user-chosen font. |
SetSelectedFont | Sets the currently selected font. |
MaxPointSize | See GetMaxPointSize and SetMaxPointSize |
SelectedFont | See GetSelectedFont and SetSelectedFont |
This control allows the user to select a font.
Possible constructors:
FontPickerCtrl()
FontPickerCtrl(parent, id=ID_ANY, font=NullFont, pos=DefaultPosition,
size=DefaultSize, style=FNTP_DEFAULT_STYLE, validator=DefaultValidator,
name=FontPickerCtrlNameStr)
Overloaded Implementations:
__init__ (self)
__init__ (self, parent, id=ID_ANY, font=NullFont, pos=DefaultPosition, size=DefaultSize, style=FNTP_DEFAULT_STYLE, validator=DefaultValidator, name=FontPickerCtrlNameStr)
Initializes the object and calls Create with all the parameters.
Parameters: |
---|
Creates this widget with given parameters.
Parameters: |
|
---|---|
Return type: | bool |
Returns: | True if the control was successfully created or False if creation failed. |
Returns the maximum point size value allowed for the user-chosen font.
Return type: | int |
---|
Returns the currently selected font.
Note that this function is completely different from Window.GetFont .
Return type: | Font |
---|
Sets the maximum point size value allowed for the user-chosen font.
The default value is 100. Note that big fonts can require a lot of memory and CPU time both for creation and for rendering; thus, specially because the user has the option to specify the fontsize through a text control (see FNTP_USE_TEXTCTRL), it’s a good idea to put a limit to the maximum font size when huge fonts do not make much sense.
Parameters: | max (int) – |
---|
Sets the currently selected font.
Note that this function is completely different from Window.SetFont .
Parameters: | font (Font) – |
---|
See GetMaxPointSize and SetMaxPointSize
See GetSelectedFont and SetSelectedFont