I got this example code form this question Using Rumps in Python and OS X Without Creating a Class
@rumps.clicked("About")
def about(sender):
rumps.alert("This is a cool app!")
@rumps.clicked("Preferences")
def about(sender):
rumps.alert("This is a cool app's settings!")
app = rumps.App("My Toolbar App", title='World, Hello')
app.menu = [
rumps.MenuItem('About', icon='pony.jpg', dimensions=(18, 18)),
'Preferences',
]
app.run()
How do I create a submenu for About menuitem with values like, "About Me", "About the Project" etc?
It's pretty simple to add a submenus to
rumps— all that is required is to enclose the parent menu and children items in square brackets[]:If you wanted to add another submenu for
etc...for example you would do:Submenu items can also use
JSONlike syntax, which might be easier to manage if you have lots of children in your submenus:You can find some more examples here.