Are there any examples (or can anyone provide an example) of how to use rumps to create a system menu, including having calls to a function in a program, without using any OOP other than what's required directly by rumps?推荐答案是这您在寻找什么?您可以直接创建rumps.App的实例,然后将非成员函数装饰为@rumps.click()以使其运行.基本上:You can create an instance of rumps.App directly, then decorate your non-member functions as @rumps.click() to get them to run. Basically:@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() 这篇关于在Python和OS X中使用臀部而不创建类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-30 21:38