Reputation: 5157
To achieve sense of nativeness in my Pyinstaller packaged Kivy Python application, I would like to create menu item in OSX menu bar. If using PyQt, I can easily achieve this. But as I am using Kivy, it seems like I have to resort to other ways.
Any suggestion? I guess it will be in the range of PyObjc or AppleScript. Not sure though.
Upvotes: 3
Views: 2048
Reputation: 1338
If using PyQt, I can easily achieve this. But as I am using Kivy, it seems like I have to resort to other ways
I don't see why you can't just use the PyQt method. Create a separate file that runs the icon that is called by your main Kivy app.
Like PyQt I am sure that Kivy has an exit function that you could override and have it kill the icon thread on exiting the application.
Only potential downside (that I can think of off the top of my head) is that it might run slower than implementing in PyObjC.
Upvotes: 1
Reputation: 5442
I guess this is more to Pyinstaller question that it is as Kivy question.
It's neither :)
PyInstaller just wraps the python application into a native-looking OS X application bundle.
Since Kivy doesn't have the ability to create a menu bar icon in OS X, you have to stick with PyObjC.
First, you've got to install Xcode (if not installed yet). You can download it from the App Store or from the Apple's Developer Center.
Then install PyObjC itself:
pip install pyobjc
There are already some examples (first, another) on creating a status bar icon using PyObjC.
There's also an awesome library called rumps
which greatly simplifies the code needed to make status bar icons, menus and actions. Perhaps it may help you with status bar interacting.
Upvotes: 3
Reputation: 6647
The Kivy graphical backend provider is OpenGl, By this way Kivy applications can run on any OS(IOS, Android, Linux, Windows, ...) by unique face. you can using kivy ActionBar to show menu or create a custom widget that is difficult. this link also this one can helping you.
Upvotes: 1