wxPython – GetFont() function in wx.MenuItem
In this article we are going to learn about GetFont() function associated with the wx.MenuItem class of wxPython. GetFont() function is used to simply return the font associated with the menu item.
No parameters are required in GetFont() function.
Syntax:
wx.MenuItem.GetFont(self)Parameters:
no parameters are required in GetFont() function.Return Type:
wx.Font
Code Example:
Python3
import wx class Example(wx.Frame): def __init__( self , * args, * * kwargs): super (Example, self ).__init__( * args, * * kwargs) self .InitUI() def InitUI( self ): self .locale = wx.Locale(wx.LANGUAGE_ENGLISH) self .menubar = wx.MenuBar() self .fileMenu = wx.Menu() self .item = wx.MenuItem( self .fileMenu, 1 , '&Check' ) self .item.SetBitmap(wx.Bitmap( 'right.png' )) self .fileMenu.Append( self .item) self .menubar.Append( self .fileMenu, '&File' ) self .SetMenuBar( self .menubar) f = self .item.GetFont(); print (f.GetFamily) self .SetSize(( 350 , 250 )) self .SetTitle( 'Icons and shortcuts' ) self .Centre() def main(): app = wx.App() ex = Example( None ) ex.Show() app.MainLoop() if __name__ = = '__main__' : main() |
Output:
<built-in method GetFamily of Font object at 0x000000AD0C9A4430>
default font