Plyer是一个平台无关的Python封装器,封装了一些平台独立的API。Plyer并非要重复造轮子,而是将一些平台的差异通过简单的API进行封装。
onpython-for-android,pyjniusisused
onkivy-ios,pyobjusisused
onwindows/mac/linux,commonlyfoundlibrariesandprogramswillbeused
示例代码:
from plyer.vibrator import vibratevibrate(10) # in Plyer, the argument is in secondsSupportPlatformAndroid<4.0Android>4.0iOSWindowsOSXLinuxAccelerometerXXX XXCamera(takingpicture)XX GPSXXX NotificationsXX XXXTexttospeechXXXXXXEmail(openmailclient) XXXXXVibratorXX Sms(sendmessages)XX CompassXXX UniqueID(IMEIorSN)XXXXXXGyroscopeXXX BatteryXXXXXXNativefilechooser XXX
评论