This class is a helper used for wx.Font creation using named parameter idiom: it allows to specify various wx.Font attributes using the chained calls to its clearly named methods instead of passing them in the fixed order to wx.Font constructors.
For example, to create an italic font with the given face name and size you could use:
font = wx.Font(wx.FontInfo(12).FaceName("Helvetica").Italic())
Notice that all of the methods of this object return a reference to the object itself, allowing the calls to them to be chained as in the example above.
All methods taking boolean parameters can be used to turn the specified font attribute on or off and turn it on by default.
New in version 2.9.5.
__init__ |
Default constructor uses the default font size for the current platform. |
AllFlags |
Set all the font attributes at once. |
AntiAliased |
Set anti-aliasing flag. |
Bold |
Use a bold version of the font. |
Encoding |
Set the font encoding to use. |
FaceName |
Set the font face name to use. |
Family |
Set the font family. |
Italic |
Use an italic version of the font. |
Light |
Use a lighter version of the font. |
Slant |
Use a slanted version of the font. |
Strikethrough |
Use a strike-through version of the font. |
Underlined |
Use an underlined version of the font. |
wx.
FontInfo
(object)¶Possible constructors:
FontInfo()
FontInfo(pointSize)
FontInfo(pixelSize)
This class is a helper used for Font creation using named parameter idiom: it allows to specify various Font attributes using the chained calls to its clearly named methods instead of passing them in the fixed order to Font constructors.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor uses the default font size for the current platform.
__init__ (self, pointSize)
Constructor setting the font size in points to use.
Parameters: | pointSize (int) – |
---|
See also
__init__ (self, pixelSize)
Constructor setting the font size in pixels to use.
Parameters: | pixelSize (wx.Size) – |
---|
See also
AllFlags
(self, flags)¶Set all the font attributes at once.
See wx.FontFlag for the various flags that can be used.
Parameters: | flags (int) – |
---|---|
Return type: | wx.FontInfo |
AntiAliased
(self, antiAliased=True)¶Set anti-aliasing flag.
Force the use of anti-aliasing on or off.
Currently this is not implemented, i.e. using this method doesn’t do anything.
Parameters: | antiAliased (bool) – |
---|---|
Return type: | wx.FontInfo |
Bold
(self, bold=True)¶Use a bold version of the font.
Parameters: | bold (bool) – |
---|---|
Return type: | wx.FontInfo |
See also
Encoding
(self, encoding)¶Set the font encoding to use.
This is mostly unneeded in Unicode builds of wxWidgets.
Parameters: | encoding (FontEncoding) – |
---|---|
Return type: | wx.FontInfo |
See also
FaceName
(self, faceName)¶Set the font face name to use.
Face names are not portable, so prefer to use Family
in portable code.
Parameters: | faceName (string) – |
---|---|
Return type: | wx.FontInfo |
See also
Family
(self, family)¶Set the font family.
The family is a generic portable way of referring to fonts without specifying a precise face name. This parameter must be one of the wx.FontFamily enumeration values.
If the FaceName
is used, then it overrides the font family.
Parameters: | family (FontFamily) – |
---|---|
Return type: | wx.FontInfo |
See also
Italic
(self, italic=True)¶Use an italic version of the font.
Parameters: | italic (bool) – |
---|---|
Return type: | wx.FontInfo |
See also
Light
(self, light=True)¶Use a lighter version of the font.
Parameters: | light (bool) – |
---|---|
Return type: | wx.FontInfo |
See also
Slant
(self, slant=True)¶Use a slanted version of the font.
Parameters: | slant (bool) – |
---|---|
Return type: | wx.FontInfo |
See also
Strikethrough
(self, strikethrough=True)¶Use a strike-through version of the font.
Currently this is only implemented in wxMSW and wxGTK.
Parameters: | strikethrough (bool) – |
---|---|
Return type: | wx.FontInfo |
Underlined
(self, underlined=True)¶Use an underlined version of the font.
Parameters: | underlined (bool) – |
---|---|
Return type: | wx.FontInfo |