Python – EnableTop() function in wx.MenuBar
Last Updated :
10 May, 2020
In this article we will learn about EnableTop() function of wx.MenuBar class of wxPython. The only difference b/w Enable() and EnableTop() is that EnableTop() is used to make the whole Menu in Menu Bar unclickable or clickable.
Syntax:
wx.MenuBar.EnableTop(self, id, enable)
Parameters :
Parameter |
Input Type |
Description |
pos |
int |
The position of the menu, starting from zero. |
enable |
bool |
True to enable the menu, False to disable it. |
Code Example:
import wx
class Example(wx.Frame):
def __init__( self , * args, * * kwargs):
super (Example, self ).__init__( * args, * * kwargs)
self .InitUI()
def InitUI( self ):
menubar = wx.MenuBar()
fileMenu = wx.Menu()
fileMenu2 = wx.Menu()
fileMenu3 = wx.Menu()
menubar.Append(fileMenu, '&Menu# 1' )
menubar.Append(fileMenu2, '&Menu# 2' )
menubar.Append(fileMenu3, '&Menu# 3' )
self .SetMenuBar(menubar)
self .SetSize(( 300 , 200 ))
self .SetTitle( 'Menu Bar' )
menubar.EnableTop( 1 , False )
def main():
app = wx.App()
ex = Example( None )
ex.Show()
app.MainLoop()
if __name__ = = '__main__' :
main()
|
Share your thoughts in the comments
Please Login to comment...