***************** wx.FontPickerCtrl ***************** Inheritance diagram for `wx.FontPickerCtrl`: | .. inheritance-diagram:: wx.FontPickerCtrl | Description =========== This control allows the user to select a font. The generic implementation is a button which brings up a `wx.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 ``wx.USE_FONTPICKERCTRL`` is set to 1 (the default). .. seealso:: `wx.FontDialog `_, `wx.FontPickerEvent <../Events/wx.FontPickerEvent.html>`_ Derived From ^^^^^^^^^^^^^ * `wx.PickerBase `_ * `wx.Control `_ * `wx.Window `_ * `wx.EvtHandler `_ * `wx.Object `_ Window Styles ^^^^^^^^^^^^^ ================================================== ================================================== Window Style Description ================================================== ================================================== ``wx.FNTP_DEFAULT_STYLE`` The default style: ``wx.FNTP_FONTDESC_AS_LABEL`` | ``wx.FNTP_USEFONT_FOR_LABEL`` ``wx.FNTP_USE_TEXTCTRL`` Creates a text control to the left of the picker button which is completely managed by the `wx.FontPickerCtrl` and which can be used by the user to specify a font (see `SetSelectedFont <#SetSelectedFont>`_). The text control is automatically synchronized with button's value. ``wx.FNTP_FONTDESC_AS_LABEL`` Keeps the label of the button updated with the fontface name and the font size. E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog, will update the label (overwriting any previous label) with the "Times New Roman, 10" text. ``wx.FNTP_USEFONT_FOR_LABEL`` Uses the currently selected font to draw the label of the button. ================================================== ================================================== Event Handling ^^^^^^^^^^^^^^ ================================================== ================================================== Event Name Description ================================================== ================================================== wx.EVT_FONTPICKER_CHANGED(id, func) The user changed the font selected in the control either using the button or using text control (see ``wx.FNTP_USE_TEXTCTRL``; note that in this case the event is fired only if the user's input is valid, i.e. recognizable). ================================================== ================================================== | Control Appearance ^^^^^^^^^^^^^^^^^^ | .. figure:: ../images/wxWidgets/wxmsw/fontpickerctrl.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: ../images/wxWidgets/wxmac/fontpickerctrl.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: ../images/wxWidgets/wxgtk/fontpickerctrl.png :alt: wxGTK :figclass: floatcenter **wxGTK** | Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `GetMaxPointSize <#GetMaxPointSize>`_ * `GetSelectedFont <#GetSelectedFont>`_ * `SetMaxPointSize <#SetMaxPointSize>`_ * `SetSelectedFont <#SetSelectedFont>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `MaxPointSize <#MaxPointSize>`_ * `SelectedFont <#SelectedFont>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=-1, initial=wx.NullFont, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.FNTP_DEFAULT_STYLE, validator=wx.DefaultValidator, name=wx.FontPickerCtrlNameStr) Constructor. **Parameters:** * `parent` (`wx.Window `_) * `id` (int) * `initial` (`wx.Font `_) * `pos` (`wx.Point `_) * `size` (`wx.Size `_) * `style` (long) * `validator` (`wx.Validator `_) * `name` (string) | **Returns:** `wx.FontPickerCtrl `_ -------- .. method:: GetMaxPointSize() Returns the maximum point size value allowed for the user-chosen font. | **Returns:** `unsigned int` -------- .. method:: GetSelectedFont() Returns the currently selected font. | **Returns:** `wx.Font `_ .. note:: Note that this function is completely different from `wx.Window.GetFont `_ -------- .. method:: SetMaxPointSize(max) Sets the maximum point size value allowed for the user-chosen font. The default value is 100. **Parameters:** * `max` (int) .. note:: 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 ``wx.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. -------- .. method:: SetSelectedFont(font) Sets the currently selected font. **Parameters:** * `font` (`wx.Font `_) .. note:: Note that this function is completely different from `wx.Window.SetFont `_ -------- Properties ^^^^^^^^^^ .. attribute:: MaxPointSize See `GetMaxPointSize <#GetMaxPointSize>`_ and `SetMaxPointSize <#SetMaxPointSize>`_ .. attribute:: SelectedFont See `GetSelectedFont <#GetSelectedFont>`_ and `SetSelectedFont <#SetSelectedFont>`_