【簡単】Python3でタスクバー常駐型Macアプリを作る方法

macOS環境で、タスクバー(ステータスバー)に常駐するシンプルなMacアプリをPython3で開発する方法を解説します。

rumpsとは、macOS環境でステータスバーに常駐するタイプのアプリを開発するPythonライブラリです。ちょっとしたアプリなら、非常にシンプルに書けるのが特徴。Python2.6以上の環境(Python3系もOK)で使えます。rumps を使うにはPyObjC ライブラリも必要になります。

公式ドキュメントはこちら。詳しく使い方が書かれています。

githubのリポジトリはこちら。

  • macOS Siella Ver.10.12.6
  • Python3.6.4
  • rumps ライブラリをインストールします。
pipでrumpsをインストールする
/Users/dev% pip3 install rumps
 
Collecting rumps
  Downloading rumps-0.2.2.tar.gz
Collecting pyobjc (from rumps)
  Downloading pyobjc-4.1-py3-none-any.whl
Collecting pyobjc-framework-NotificationCenter==4.1; platform_release >= "14.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_NotificationCenter-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-AppleScriptObjC==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_AppleScriptObjC-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-Cocoa==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_Cocoa-4.1-cp36-cp36m-macosx_10_6_intel.whl (302kB)
    100% |████████████████████████████████| 307kB 2.7MB/s
Collecting pyobjc-framework-OpenDirectory==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_OpenDirectory-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-CoreBluetooth==4.1; platform_release >= "14.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_CoreBluetooth-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-Collaboration==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_Collaboration-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-MediaAccessibility==4.1; platform_release >= "13.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_MediaAccessibility-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-Intents==4.1; platform_release >= "16.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_Intents-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-GameKit==4.1; platform_release >= "12.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_GameKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-Contacts==4.1; platform_release >= "15.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_Contacts-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-libdispatch==4.1; platform_release >= "12.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_libdispatch-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-ContactsUI==4.1; platform_release >= "15.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_ContactsUI-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-DictionaryServices==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_DictionaryServices-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-CoreServices==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_CoreServices-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-AVFoundation==4.1; platform_release >= "11.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_AVFoundation-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-SecurityFoundation==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_SecurityFoundation-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-ServiceManagement==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_ServiceManagement-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-CryptoTokenKit==4.1; platform_release >= "14.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_CryptoTokenKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-CoreText==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_CoreText-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-CoreWLAN==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_CoreWLAN-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-GameController==4.1; platform_release >= "13.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_GameController-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-SecurityInterface==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_SecurityInterface-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-GameplayKit==4.1; platform_release >= "15.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_GameplayKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-Photos==4.1; platform_release >= "15.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_Photos-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-MediaPlayer==4.1; platform_release >= "16.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_MediaPlayer-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-IMServicePlugIn==4.1; platform_release >= "11.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_IMServicePlugIn-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-GameCenter==4.1; platform_release >= "12.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_GameCenter-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-FinderSync==4.1; platform_release >= "14.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_FinderSync-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-LocalAuthentication==4.1; platform_release >= "14.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_LocalAuthentication-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-SystemConfiguration==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_SystemConfiguration-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-InputMethodKit==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_InputMethodKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-MultipeerConnectivity==4.1; platform_release >= "14.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_MultipeerConnectivity-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-ModelIO==4.1; platform_release >= "15.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_ModelIO-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-WebKit==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_WebKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-SpriteKit==4.1; platform_release >= "13.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_SpriteKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-Security==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_Security-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-IOSurface==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_IOSurface-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-CoreData==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_CoreData-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-AddressBook==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_AddressBook-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-NetFS==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_NetFS-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-Social==4.1; platform_release >= "12.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_Social-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-CoreLocation==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_CoreLocation-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-PhotosUI==4.1; platform_release >= "15.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_PhotosUI-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-PubSub==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_PubSub-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-SceneKit==4.1; platform_release >= "11.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_SceneKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-CFNetwork==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_CFNetwork-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-InstallerPlugins==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_InstallerPlugins-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-LatentSemanticMapping==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_LatentSemanticMapping-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-QTKit==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_QTKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-SyncServices==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_SyncServices-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-SafariServices==4.1; platform_release >= "15.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_SafariServices-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-ScreenSaver==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_ScreenSaver-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-CloudKit==4.1; platform_release >= "14.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_CloudKit-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-Accounts==4.1; platform_release >= "12.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_Accounts-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-FSEvents==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_FSEvents-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-ApplicationServices==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_ApplicationServices-4.1-py2.py3-none-any.whl
Collecting pyobjc-core==4.1 (from pyobjc->rumps)
  Downloading pyobjc_core-4.1-cp36-cp36m-macosx_10_6_intel.whl (509kB)
    100% |████████████████████████████████| 512kB 2.3MB/s
Collecting pyobjc-framework-Quartz==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_Quartz-4.1-cp36-cp36m-macosx_10_6_intel.whl (129kB)
    100% |████████████████████████████████| 133kB 4.5MB/s
Collecting pyobjc-framework-MediaLibrary==4.1; platform_release >= "13.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_MediaLibrary-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-DiskArbitration==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_DiskArbitration-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-EventKit==4.1; platform_release >= "12.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_EventKit-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-ScriptingBridge==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_ScriptingBridge-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-ImageCaptureCore==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_ImageCaptureCore-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-AppleScriptKit==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_AppleScriptKit-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-LaunchServices==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_LaunchServices-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-PreferencePanes==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_PreferencePanes-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-CalendarStore==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_CalendarStore-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-InstantMessage==4.1; platform_release >= "9.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_InstantMessage-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-AVKit==4.1; platform_release >= "13.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_AVKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-StoreKit==4.1; platform_release >= "11.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_StoreKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-iTunesLibrary==4.1; platform_release >= "10.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_iTunesLibrary-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-Automator==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_Automator-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-ExceptionHandling==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_ExceptionHandling-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-MapKit==4.1; platform_release >= "13.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_MapKit-4.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting pyobjc-framework-SearchKit==4.1 (from pyobjc->rumps)
  Downloading pyobjc_framework_SearchKit-4.1-py2.py3-none-any.whl
Collecting pyobjc-framework-NetworkExtension==4.1; platform_release >= "15.0" (from pyobjc->rumps)
  Downloading pyobjc_framework_NetworkExtension-4.1-cp36-cp36m-macosx_10_6_intel.whl
Building wheels for collected packages: rumps
  Running setup.py bdist_wheel for rumps ... done
  Stored in directory: /Users/zero/Library/Caches/pip/wheels/e4/c0/0a/2569f7d17d88a46c988ebb76e49a6235fe4df9be4a219df997
Successfully built rumps
Installing collected packages: pyobjc-core, pyobjc-framework-Cocoa, pyobjc-framework-NotificationCenter, pyobjc-framework-AppleScriptObjC, pyobjc-framework-OpenDirectory, pyobjc-framework-CoreBluetooth, pyobjc-framework-Collaboration, pyobjc-framework-MediaAccessibility, pyobjc-framework-Intents, pyobjc-framework-Quartz, pyobjc-framework-GameKit, pyobjc-framework-Contacts, pyobjc-framework-libdispatch, pyobjc-framework-ContactsUI, pyobjc-framework-DictionaryServices, pyobjc-framework-LaunchServices, pyobjc-framework-FSEvents, pyobjc-framework-SearchKit, pyobjc-framework-CoreServices, pyobjc-framework-AVFoundation, pyobjc-framework-Security, pyobjc-framework-SecurityFoundation, pyobjc-framework-ServiceManagement, pyobjc-framework-CryptoTokenKit, pyobjc-framework-CoreText, pyobjc-framework-CoreWLAN, pyobjc-framework-GameController, pyobjc-framework-SecurityInterface, pyobjc-framework-SpriteKit, pyobjc-framework-GameplayKit, pyobjc-framework-Photos, pyobjc-framework-MediaPlayer, pyobjc-framework-IMServicePlugIn, pyobjc-framework-GameCenter, pyobjc-framework-FinderSync, pyobjc-framework-LocalAuthentication, pyobjc-framework-SystemConfiguration, pyobjc-framework-InputMethodKit, pyobjc-framework-MultipeerConnectivity, pyobjc-framework-ModelIO, pyobjc-framework-WebKit, pyobjc-framework-IOSurface, pyobjc-framework-CoreData, pyobjc-framework-AddressBook, pyobjc-framework-NetFS, pyobjc-framework-Social, pyobjc-framework-CoreLocation, pyobjc-framework-PhotosUI, pyobjc-framework-PubSub, pyobjc-framework-SceneKit, pyobjc-framework-CFNetwork, pyobjc-framework-InstallerPlugins, pyobjc-framework-LatentSemanticMapping, pyobjc-framework-QTKit, pyobjc-framework-SyncServices, pyobjc-framework-SafariServices, pyobjc-framework-ScreenSaver, pyobjc-framework-Accounts, pyobjc-framework-CloudKit, pyobjc-framework-ApplicationServices, pyobjc-framework-MediaLibrary, pyobjc-framework-DiskArbitration, pyobjc-framework-EventKit, pyobjc-framework-ScriptingBridge, pyobjc-framework-ImageCaptureCore, pyobjc-framework-AppleScriptKit, pyobjc-framework-PreferencePanes, pyobjc-framework-CalendarStore, pyobjc-framework-InstantMessage, pyobjc-framework-AVKit, pyobjc-framework-StoreKit, pyobjc-framework-iTunesLibrary, pyobjc-framework-Automator, pyobjc-framework-ExceptionHandling, pyobjc-framework-MapKit, pyobjc-framework-NetworkExtension, pyobjc, rumps
Successfully installed pyobjc-4.1 pyobjc-core-4.1 pyobjc-framework-AVFoundation-4.1 pyobjc-framework-AVKit-4.1 pyobjc-framework-Accounts-4.1 pyobjc-framework-AddressBook-4.1 pyobjc-framework-AppleScriptKit-4.1 pyobjc-framework-AppleScriptObjC-4.1 pyobjc-framework-ApplicationServices-4.1 pyobjc-framework-Automator-4.1 pyobjc-framework-CFNetwork-4.1 pyobjc-framework-CalendarStore-4.1 pyobjc-framework-CloudKit-4.1 pyobjc-framework-Cocoa-4.1 pyobjc-framework-Collaboration-4.1 pyobjc-framework-Contacts-4.1 pyobjc-framework-ContactsUI-4.1 pyobjc-framework-CoreBluetooth-4.1 pyobjc-framework-CoreData-4.1 pyobjc-framework-CoreLocation-4.1 pyobjc-framework-CoreServices-4.1 pyobjc-framework-CoreText-4.1 pyobjc-framework-CoreWLAN-4.1 pyobjc-framework-CryptoTokenKit-4.1 pyobjc-framework-DictionaryServices-4.1 pyobjc-framework-DiskArbitration-4.1 pyobjc-framework-EventKit-4.1 pyobjc-framework-ExceptionHandling-4.1 pyobjc-framework-FSEvents-4.1 pyobjc-framework-FinderSync-4.1 pyobjc-framework-GameCenter-4.1 pyobjc-framework-GameController-4.1 pyobjc-framework-GameKit-4.1 pyobjc-framework-GameplayKit-4.1 pyobjc-framework-IMServicePlugIn-4.1 pyobjc-framework-IOSurface-4.1 pyobjc-framework-ImageCaptureCore-4.1 pyobjc-framework-InputMethodKit-4.1 pyobjc-framework-InstallerPlugins-4.1 pyobjc-framework-InstantMessage-4.1 pyobjc-framework-Intents-4.1 pyobjc-framework-LatentSemanticMapping-4.1 pyobjc-framework-LaunchServices-4.1 pyobjc-framework-LocalAuthentication-4.1 pyobjc-framework-MapKit-4.1 pyobjc-framework-MediaAccessibility-4.1 pyobjc-framework-MediaLibrary-4.1 pyobjc-framework-MediaPlayer-4.1 pyobjc-framework-ModelIO-4.1 pyobjc-framework-MultipeerConnectivity-4.1 pyobjc-framework-NetFS-4.1 pyobjc-framework-NetworkExtension-4.1 pyobjc-framework-NotificationCenter-4.1 pyobjc-framework-OpenDirectory-4.1 pyobjc-framework-Photos-4.1 pyobjc-framework-PhotosUI-4.1 pyobjc-framework-PreferencePanes-4.1 pyobjc-framework-PubSub-4.1 pyobjc-framework-QTKit-4.1 pyobjc-framework-Quartz-4.1 pyobjc-framework-SafariServices-4.1 pyobjc-framework-SceneKit-4.1 pyobjc-framework-ScreenSaver-4.1 pyobjc-framework-ScriptingBridge-4.1 pyobjc-framework-SearchKit-4.1 pyobjc-framework-Security-4.1 pyobjc-framework-SecurityFoundation-4.1 pyobjc-framework-SecurityInterface-4.1 pyobjc-framework-ServiceManagement-4.1 pyobjc-framework-Social-4.1 pyobjc-framework-SpriteKit-4.1 pyobjc-framework-StoreKit-4.1 pyobjc-framework-SyncServices-4.1 pyobjc-framework-SystemConfiguration-4.1 pyobjc-framework-WebKit-4.1 pyobjc-framework-iTunesLibrary-4.1 pyobjc-framework-libdispatch-4.1 rumps-0.2.2
  • インストール後にpipコマンドで確認すると、rumps(0.2.2)とpyobjc(4.1)関連のライブラリがインストールされているのがわかります。rumpsインストール時に、pyobjcがインストールされていない場合、自動的にpyobjcもインストールされます。
rumpsがインストールされているか確認する
/Users/dev% pip3 list
 
pyobjc (4.1)
pyobjc-core (4.1)
pyobjc-framework-Accounts (4.1)
pyobjc-framework-AddressBook (4.1)
pyobjc-framework-AppleScriptKit (4.1)
pyobjc-framework-AppleScriptObjC (4.1)
pyobjc-framework-ApplicationServices (4.1)
pyobjc-framework-Automator (4.1)
pyobjc-framework-AVFoundation (4.1)
pyobjc-framework-AVKit (4.1)
pyobjc-framework-CalendarStore (4.1)
pyobjc-framework-CFNetwork (4.1)
pyobjc-framework-CloudKit (4.1)
pyobjc-framework-Cocoa (4.1)
pyobjc-framework-Collaboration (4.1)
pyobjc-framework-Contacts (4.1)
pyobjc-framework-ContactsUI (4.1)
pyobjc-framework-CoreBluetooth (4.1)
pyobjc-framework-CoreData (4.1)
pyobjc-framework-CoreLocation (4.1)
pyobjc-framework-CoreServices (4.1)
pyobjc-framework-CoreText (4.1)
pyobjc-framework-CoreWLAN (4.1)
pyobjc-framework-CryptoTokenKit (4.1)
pyobjc-framework-DictionaryServices (4.1)
pyobjc-framework-DiskArbitration (4.1)
pyobjc-framework-EventKit (4.1)
pyobjc-framework-ExceptionHandling (4.1)
pyobjc-framework-FinderSync (4.1)
pyobjc-framework-FSEvents (4.1)
pyobjc-framework-GameCenter (4.1)
pyobjc-framework-GameController (4.1)
pyobjc-framework-GameKit (4.1)
pyobjc-framework-GameplayKit (4.1)
pyobjc-framework-ImageCaptureCore (4.1)
pyobjc-framework-IMServicePlugIn (4.1)
pyobjc-framework-InputMethodKit (4.1)
pyobjc-framework-InstallerPlugins (4.1)
pyobjc-framework-InstantMessage (4.1)
pyobjc-framework-Intents (4.1)
pyobjc-framework-IOSurface (4.1)
pyobjc-framework-iTunesLibrary (4.1)
pyobjc-framework-LatentSemanticMapping (4.1)
pyobjc-framework-LaunchServices (4.1)
pyobjc-framework-libdispatch (4.1)
pyobjc-framework-LocalAuthentication (4.1)
pyobjc-framework-MapKit (4.1)
pyobjc-framework-MediaAccessibility (4.1)
pyobjc-framework-MediaLibrary (4.1)
pyobjc-framework-MediaPlayer (4.1)
pyobjc-framework-ModelIO (4.1)
pyobjc-framework-MultipeerConnectivity (4.1)
pyobjc-framework-NetFS (4.1)
pyobjc-framework-NetworkExtension (4.1)
pyobjc-framework-NotificationCenter (4.1)
pyobjc-framework-OpenDirectory (4.1)
pyobjc-framework-Photos (4.1)
pyobjc-framework-PhotosUI (4.1)
pyobjc-framework-PreferencePanes (4.1)
pyobjc-framework-PubSub (4.1)
pyobjc-framework-QTKit (4.1)
pyobjc-framework-Quartz (4.1)
pyobjc-framework-SafariServices (4.1)
pyobjc-framework-SceneKit (4.1)
pyobjc-framework-ScreenSaver (4.1)
pyobjc-framework-ScriptingBridge (4.1)
pyobjc-framework-SearchKit (4.1)
pyobjc-framework-Security (4.1)
pyobjc-framework-SecurityFoundation (4.1)
pyobjc-framework-SecurityInterface (4.1)
pyobjc-framework-ServiceManagement (4.1)
pyobjc-framework-Social (4.1)
pyobjc-framework-SpriteKit (4.1)
pyobjc-framework-StoreKit (4.1)
pyobjc-framework-SyncServices (4.1)
pyobjc-framework-SystemConfiguration (4.1)
pyobjc-framework-WebKit (4.1)
rumps (0.2.2)
  • これで、rumpsが使えるようになりました。

公式サイトに掲載されているサンプルソースコードを一部日本語化したものです。下記のソースコードを実行するとアプリが起動し、Macのタスクバー(ステータスバー)に常駐します。

import rumps

class AwesomeStatusBarApp(rumps.App):
    @rumps.clicked("設定")
    def prefs(self, _):
        rumps.alert("メッセージを表示します。")

    @rumps.clicked("ON-OFFスイッチ")
    def onoff(self, sender):
        sender.state = not sender.state

    @rumps.clicked("メッセージ通知")
    def sayhi(self, _):
        rumps.notification("Awesome title", "amazing subtitle", "hi!!1")

if __name__ == "__main__":
    AwesomeStatusBarApp("タスクバーアプリサンプル").run()

上記のソースを実行すると、このように表示されます。


Macでタスクバーにちょっとした情報を通知したり、ON、OFF操作をするようなシンプルなアプリの開発に向いているライブラリです。とても簡単にステータスバーアプリ開発ができるので、使ってみて下さい。

コメントを入力:
E​ K Y Q O