### Playing and Stopping Audio with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to play and stop audio using the plyer.facades.Audio class. It includes methods to play, stop, and start audio playback. ```python from plyer import facades # Play audio facades.Audio.play() # Start audio playback facades.Audio.start() # Stop audio playback facades.Audio.stop() ``` -------------------------------- ### Audio Playback and Recording Source: https://plyer.readthedocs.io/en/latest/api Manage audio playback and recording. Allows playing the current recording, starting a new recording, and stopping the recording. ```Python from plyer import audio # Start recording audio audio.start() # Stop recording audio audio.stop() # Play the recorded audio audio.play() ``` -------------------------------- ### Interacting with GPS using Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to interact with the device's GPS capabilities using the plyer.facades.GPS class. It includes methods to start and stop GPS updates. ```python from plyer import facades # Start GPS updates facades.GPS.start() # Stop GPS updates facades.GPS.stop() ``` -------------------------------- ### Speech Recognition (STT) with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to use the Speech Recognition (STT) functionality with the plyer.facades.STT class. It includes methods to start and stop recognition, and access results and supported languages. ```python from plyer import facades # Start speech recognition facades.STT.start() # Stop speech recognition facades.STT.stop() # Get recognition results recognition_results = facades.STT.results # Check for partial results partial_results = facades.STT.partial_results # Get supported languages supported_languages = facades.STT.supported_languages # Set language preference facades.STT.prefer_offline = True facades.STT.language = 'en-US' ``` -------------------------------- ### Open Maps Application Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to open the device's default maps application, potentially to display a location or get directions. It requires the `maps` module. ```Python from plyer import maps # Show a specific location on the map # maps.show_map(lat=34.0522, lon=-118.2437) # Get directions to a location # maps.view_map(lat=34.0522, lon=-118.2437, title='Destination') ``` -------------------------------- ### Access Wi-Fi Information Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to get information about the device's Wi-Fi connection, such as SSID or connection status. It requires the `wifi` module. ```Python from plyer import wifi # Get Wi-Fi connection status wifi_status = wifi.status() print(f"Wi-Fi Status: {wifi_status}") ``` -------------------------------- ### Get Processor Information Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to retrieve information about the device's processors. It requires the `processors` module. ```Python from plyer import processors # Get processor information proc_info = processors.info() print(f"Processor Info: {proc_info}") ``` -------------------------------- ### Checking Wi-Fi Status with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to check Wi-Fi status using the plyer.facades.Wifi class. It includes methods to check if Wi-Fi is connected and enabled, and to start scanning for networks. ```python from plyer import facades # Check if Wi-Fi is connected is_wifi_connected = facades.Wifi.is_connected() # Check if Wi-Fi is enabled is_wifi_enabled = facades.Wifi.is_enabled() # Start Wi-Fi scanning facades.Wifi.start_scanning() ``` -------------------------------- ### Plyer Light API Source: https://plyer.readthedocs.io/en/latest/genindex Accesses the light sensor to get ambient light levels. Methods include enabling/disabling the listener. ```python from plyer import light # Example usage: # light_level = light.light # light.enable() # light.disable() ``` -------------------------------- ### Plyer StoragePath API Source: https://plyer.readthedocs.io/en/latest/genindex Provides methods to get common directory paths on the device, such as application directory, documents directory, downloads directory, etc. ```python from plyer import storagepath # Example usage: # app_dir = storagepath.get_application_dir() # docs_dir = storagepath.get_documents_dir() # downloads_dir = storagepath.get_downloads_dir() # external_storage_dir = storagepath.get_external_storage_dir() # home_dir = storagepath.get_home_dir() # music_dir = storagepath.get_music_dir() # pictures_dir = storagepath.get_pictures_dir() # root_dir = storagepath.get_root_dir() # sdcard_dir = storagepath.get_sdcard_dir() # videos_dir = storagepath.get_videos_dir() ``` -------------------------------- ### Accessing STT Language with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to get the list of supported languages for Speech-to-Text (STT) functionality using the plyer.facades.STT property. ```python from plyer import facades # Get supported languages for STT supported_stt_languages = facades.STT.supported_languages ``` -------------------------------- ### Get Storage Path Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to retrieve the appropriate storage path for the application on the device. It requires the `storagepath` module. ```Python from plyer import storagepath # Get the application's documents directory doc_path = storagepath.get_documents_dir() print(f"Documents Directory: {doc_path}") ``` -------------------------------- ### Get Device Name Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to retrieve the name of the device. It requires the `devicename` module. ```Python from plyer import devicename # Get the device name device_name = devicename.name() print(f"Device Name: {device_name}") ``` -------------------------------- ### Plyer Temperature API Source: https://plyer.readthedocs.io/en/latest/genindex Accesses the temperature sensor to get ambient temperature data. Methods include enabling/disabling the listener. ```python from plyer import temperature # Example usage: # temp_data = temperature.temperature # temperature.enable() # temperature.disable() ``` -------------------------------- ### Get CPU Information Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to retrieve information about the device's CPU, such as CPU usage or core count. It requires the `cpu` module. ```Python from plyer import cpu # Get CPU usage cpu_usage = cpu.cpu_usage() print(f"CPU Usage: {cpu_usage}") ``` -------------------------------- ### Plyer Accelerometer API Source: https://plyer.readthedocs.io/en/latest/genindex Accesses the accelerometer sensor to get acceleration data. Methods include enabling/disabling the listener and accessing acceleration properties. ```python from plyer import accelerometer # Example usage: # acceleration = accelerometer.acceleration # accelerometer.enable() # accelerometer.disable() ``` -------------------------------- ### Access Temperature Sensor Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to access the temperature sensor to get ambient temperature readings. It requires the `temperature` module and a temperature sensor. ```Python from plyer import temperature # Get temperature data temp_data = temperature.temperature print(f"Temperature: {temp_data}") ``` -------------------------------- ### Plyer Wifi API Source: https://plyer.readthedocs.io/en/latest/genindex Provides access to Wi-Fi functionalities, such as getting network information and available networks. Methods include enabling/disabling the listener, connecting, and disconnecting. ```python from plyer import wifi # Example usage: # wifi.enable() # network_info = wifi.get_network_info() # available_networks = wifi.get_available_wifi() # wifi.connect('SSID', 'PASSWORD') # wifi.disconnect() # wifi.disable() ``` -------------------------------- ### Access Compass Sensor Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to access the compass sensor to get magnetic heading information. It requires the `compass` module and a magnetic field sensor. ```Python from plyer import compass # Get compass data compass_data = compass.field print(f"Magnetic Field: {compass_data}") ``` -------------------------------- ### Access Battery Status Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to get information about the device's battery status, including charge level and whether it is charging. It requires the `battery` module. ```Python from plyer import battery # Get battery status battery_status = battery.status print(f"Battery Status: {battery_status}") ``` -------------------------------- ### Access Humidity Sensor Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to access the humidity sensor to get relative humidity readings. It requires the `humidity` module and a humidity sensor. ```Python from plyer import humidity # Get humidity data humidity_data = humidity.humidity print(f"Humidity: {humidity_data}") ``` -------------------------------- ### Access Gyroscope Sensor Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to access the gyroscope sensor to get rotation rate data. It requires the `gyroscope` module and a gyroscope sensor. ```Python from plyer import gyroscope # Get gyroscope data gyro_data = gyroscope.rotation print(f"Rotation Rate: {gyro_data}") ``` -------------------------------- ### Access Gravity Sensor Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to access the gravity sensor to get gravity vector data. It requires the `gravity` module and a suitable sensor. ```Python from plyer import gravity # Get gravity data gravity_data = gravity.gravity print(f"Gravity: {gravity_data}") ``` -------------------------------- ### Get Device Orientation Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to retrieve the device's current orientation (e.g., portrait, landscape). It requires the `orientation` module and sensors that detect orientation. ```Python from plyer import orientation # Get current orientation current_orientation = orientation.get() print(f"Device Orientation: {current_orientation}") ``` -------------------------------- ### Light Sensor Control Source: https://plyer.readthedocs.io/en/latest/api Manages the Light sensor to measure ambient light levels. Includes methods to enable and disable the sensor, and a property to get the current illumination in lux. Supports Android platform. ```python from plyer import light light.enable() # Get current illumination illumination_level = light.illumination light.disable() ``` -------------------------------- ### Speech to Text (STT) Functionality Source: https://plyer.readthedocs.io/en/latest/api Provides speech recognition capabilities. Allows starting and stopping listening, checking for availability, and retrieving results. Supports language preferences and lists errors or partial results. ```Python from plyer import stt # Check if speech recognition is available if stt.exist(): print("Speech recognition is available.") # Start listening stt.start() # To stop listening later: # stt.stop() # Access results: # print(stt.results) # print(stt.partial_results) # print(stt.errors) # Set preference for offline recognition # stt.prefer_offline = True # Get supported languages # print(stt.supported_languages) # Get current language # print(stt.language) else: print("Speech recognition is not available.") ``` -------------------------------- ### Plyer Compass API Source: https://plyer.readthedocs.io/en/latest/genindex Accesses the compass sensor to get directional data. Methods include enabling/disabling the listener, getting field data, and retrieving uncalibrated field data. ```python from plyer import compass # Example usage: # compass_data = compass.field # uncalibrated_data = compass.field_uncalib # compass.enable() # compass.disable() # compass.get_field_uncalib() ``` -------------------------------- ### Initiate Phone Calls Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to initiate a phone call to a specified number. It requires the `call` module and the device's telephony capabilities. ```Python from plyer import call # Make a phone call call.make_call(phone_number='123-456-7890') ``` -------------------------------- ### Making Phone Calls with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to initiate a phone call using the plyer.facades.Call class. It includes a method to make a call to a specified number. ```python from plyer import facades # Make a phone call facades.Call.makecall(number='+1234567890') ``` -------------------------------- ### Accelerometer Sensor Control Source: https://plyer.readthedocs.io/en/latest/api Control the accelerometer sensor to get acceleration data. The sensor can be enabled or disabled. ```Python from plyer import accelerometer # Enable the accelerometer sensor accelerometer.enable() # Get current acceleration data accel_data = accelerometer.acceleration print(f"Acceleration: {accel_data}") # Disable the accelerometer sensor accelerometer.disable() ``` -------------------------------- ### Temperature Sensor Reading Source: https://plyer.readthedocs.io/en/latest/api Accesses the device's temperature sensor to measure ambient room temperature in Celsius. Includes methods to enable/disable the sensor and a property to get the current temperature. ```Python from plyer import temperature # Enable the temperature sensor temperature.enable() # Get the current temperature current_temp = temperature.temperature print(f"Current temperature: {current_temp}°C") # Disable the temperature sensor # temperature.disable() ``` -------------------------------- ### Plyer Gyroscope API Source: https://plyer.readthedocs.io/en/latest/genindex Accesses the gyroscope sensor to get rotational data. Methods include enabling/disabling the listener. ```python from plyer import gyroscope # Example usage: # gyro_data = gyroscope.rotation # gyroscope.enable() # gyroscope.disable() ``` -------------------------------- ### Handling File Chooser with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to use the FileChooser facade from plyer.facades to open files. It includes methods to open a file and to save a file. ```python from plyer import facades # Open a file facades.FileChooser.open_file() # Save a file facades.FileChooser.save_file() ``` -------------------------------- ### Access Audio Features Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to interact with audio features using Plyer. It allows for playing and recording audio, depending on the platform's capabilities and available audio hardware. ```Python from plyer import audio # Example: Play a sound file (implementation specific) audio.play('path/to/sound.wav') # Example: Start recording (implementation specific) audio.record('output.wav') ``` -------------------------------- ### Get Unique Device ID Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to retrieve a unique identifier for the device. It requires the `uniqueid` module. ```Python from plyer import uniqueid # Get the unique device ID device_id = uniqueid.id print(f"Unique Device ID: {device_id}") ``` -------------------------------- ### Keystore Operations with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to interact with the device's Keystore using the plyer.facades.Keystore class. It allows for secure storage and retrieval of data. ```python from plyer import facades # Access Keystore (specific operations depend on implementation) keystore_instance = facades.Keystore ``` -------------------------------- ### Camera Operations with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to operate the device's camera using the plyer.facades.Camera class. It includes methods to take a picture and to record a video. ```python from plyer import facades # Take a picture facades.Camera.take_picture() # Take a video facades.Camera.take_video() ``` -------------------------------- ### Access Keystore Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to interact with the device's keystore for secure storage of keys and credentials. It requires the `keystore` module. ```Python from plyer import keystore # Example: Store a key # keystore.store('my_key', 'my_secret_value') # Example: Retrieve a key # value = keystore.get('my_key') # print(f"Keystore value: {value}") ``` -------------------------------- ### Plyer Humidity API Source: https://plyer.readthedocs.io/en/latest/genindex Accesses the humidity sensor to get relative humidity data. Methods include enabling/disabling the listener. ```python from plyer import humidity # Example usage: # humidity_level = humidity.humidity # humidity.enable() # humidity.disable() ``` -------------------------------- ### Access Camera for Photos/Videos Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to access the device's camera to capture photos or videos. It requires the `camera` module and camera hardware. ```Python from plyer import camera # Example: Take a picture (implementation specific) # camera.take_picture('path/to/save/image.jpg') # Example: Start video recording (implementation specific) # camera.record_video('path/to/save/video.mp4') ``` -------------------------------- ### Light Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to ambient light sensor data. This is a proxy to the Light facade. ```Python plyer.light ``` -------------------------------- ### Accessing Vibrator Pattern with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to use the Vibrator facade to create custom vibration patterns. It includes a method to define a pattern for the vibrator. ```python from plyer import facades # Define a vibration pattern (e.g., short pulse, pause, longer pulse) vibration_pattern = [0.1, 0.2, 0.3, 0.4, 0.5] facades.Vibrator.pattern(time=vibration_pattern) ``` -------------------------------- ### Plyer Gravity API Source: https://plyer.readthedocs.io/en/latest/genindex Accesses the gravity sensor to get gravity vector data. Methods include enabling/disabling the listener and accessing gravity properties. ```python from plyer import gravity # Example usage: # gravity_vector = gravity.gravity # gravity.enable() # gravity.disable() ``` -------------------------------- ### Access Light Sensor Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to access the light sensor to measure ambient light levels. It requires the `light` module and a light sensor. ```Python from plyer import light # Get light sensor data light_data = light.light print(f"Ambient Light: {light_data}") ``` -------------------------------- ### Audio Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to audio functionalities. This is a proxy to the Audio facade. ```Python plyer.audio ``` -------------------------------- ### Plyer FileChooser API Source: https://plyer.readthedocs.io/en/latest/genindex Allows the user to choose files or directories. The choose_dir() method is available. ```python from plyer import filechooser # Example usage: # selected_dir = filechooser.choose_dir() # print(f"Selected directory: {selected_dir}") ``` -------------------------------- ### Accessing Screenshot Functionality with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to take a screenshot using the plyer.facades.Screenshot class. It includes a method to capture the current screen. ```python from plyer import facades # Take a screenshot facades.Screenshot.screenshot() ``` -------------------------------- ### Controlling Flashlight with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to control the device's flashlight using the plyer.facades.Flash class. It includes methods to turn the flashlight on and off, and to release the resource. ```python from plyer import facades # Turn flashlight on facades.Flash.on() # Turn flashlight off facades.Flash.off() # Release flashlight resource facades.Flash.release() ``` -------------------------------- ### IrBlaster Functionality with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to use the IrBlaster facade from plyer.facades for infrared transmission. It includes methods for transmitting data and converting time units. ```python from plyer import facades # Transmit data via IrBlaster facades.IrBlaster.transmit(data='...') # Convert microseconds to periods periods = facades.IrBlaster.microseconds_to_periods(1000) # Convert periods to microseconds microseconds = facades.IrBlaster.periods_to_microseconds(50) ``` -------------------------------- ### Compass Sensor Control Source: https://plyer.readthedocs.io/en/latest/api Manage the compass sensor to get magnetic field readings. The sensor can be enabled or disabled, and provides calibrated and uncalibrated field data. ```Python from plyer import compass # Enable the compass sensor compass.enable() # Get current magnetic field data (calibrated) field_data = compass.field print(f"Magnetic Field: {field_data}") # Get uncalibrated magnetic field data uncalibrated_field_data = compass.field_uncalib print(f"Uncalibrated Magnetic Field: {uncalibrated_field_data}") # Get orientation (deprecated, use compass.field) # orientation_data = compass.orientation # print(f"Orientation: {orientation_data}") # Disable the compass sensor compass.disable() ``` -------------------------------- ### Brightness Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to screen brightness controls. This is a proxy to the Brightness facade. ```Python plyer.brightness ``` -------------------------------- ### File Chooser Dialog Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to open a file chooser dialog for selecting files. It requires the `filechooser` module and platform-specific implementation. ```Python from plyer import filechooser # Open file chooser to select a file # file_path = filechooser.open_file() # print(f"Selected file: {file_path}") # Open file chooser to save a file # file_path = filechooser.save_file() # print(f"Save file path: {file_path}") ``` -------------------------------- ### Access IR Blaster Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to use the IR blaster to send infrared signals, typically for controlling appliances. It requires the `irblaster` module and an IR blaster. ```Python from plyer import irblaster # Example: Send an IR code (implementation specific) # irblaster.send_code('0x12345678') ``` -------------------------------- ### Call Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to initiate calls. This is a proxy to the Call facade. ```Python plyer.call ``` -------------------------------- ### Light Sensor with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to access ambient light information using the plyer.facades.Light property. It provides illumination data from the device's light sensor. ```python from plyer import facades # Get ambient light illumination illumination_level = facades.Light.illumination ``` -------------------------------- ### Take Screenshots Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to capture a screenshot of the device's screen. It requires the `screenshot` module and platform support for screen capture. ```Python from plyer import screenshot # Take a screenshot and save it # screenshot.take_screenshot('path/to/save/screenshot.png') ``` -------------------------------- ### Display Notifications Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to display notifications to the user. It requires the `notification` module and platform support for notifications. ```Python from plyer import notification # Display a notification notification.notify( title='My Notification', message='This is the notification message.', app_name='My App' ) ``` -------------------------------- ### Keystore Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to the device's keystore or keyring. This is a proxy to the Keystore facade. ```Python plyer.keystore ``` -------------------------------- ### Accessing Bluetooth Information with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to access Bluetooth information using the plyer.facades.Bluetooth property. It allows retrieval of general information related to the device's Bluetooth capabilities. ```python from plyer import facades # Access Bluetooth information bluetooth_info = facades.Bluetooth.info ``` -------------------------------- ### Get GPS Location Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to retrieve the device's current GPS location, including latitude, longitude, and altitude. It requires the `gps` module and location services enabled. ```Python from plyer import gps # Configure GPS updates gps.configure(on_location=lambda **kwargs: print(f"Location: {kwargs}")) # Start GPS updates gps.start() # Stop GPS updates # gps.stop() ``` -------------------------------- ### File Chooser Operations with Plyer Source: https://plyer.readthedocs.io/en/latest/api Provides methods to interact with the file chooser dialog for selecting directories or files for opening or saving. Note that directory choosing is limited on Windows. ```Python from plyer import filechooser # Open directory chooser filechooser.choose_dir() # Open file chooser to open a file filechooser.open_file() # Open file chooser to save a file filechooser.save_file() ``` -------------------------------- ### Brightness Control with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to control the device's screen brightness using the plyer.facades.Brightness class. It includes a method to set the brightness level. ```python from plyer import facades # Set screen brightness level (0.0 to 1.0) facades.Brightness.set_level(0.7) ``` -------------------------------- ### Plyer Vibrator Facade Source: https://plyer.readthedocs.io/en/latest/api Provides methods to control device vibration. Includes functionality to cancel ongoing vibrations, check for vibrator existence, and apply vibration patterns or simple timed vibrations. ```python from plyer import vibrator # Cancel any current vibration vibrator.cancel() # Check if the device has a vibrator if vibrator.exists(): print("Device has a vibrator.") # Vibrate with a pattern (0.5s off, 1s on, repeat) vibrator.pattern([0.5, 1], repeat=0) # Vibrate for 2 seconds vibrator.vibrate(time=2) ``` -------------------------------- ### Plyer Audio API Source: https://plyer.readthedocs.io/en/latest/genindex Provides functionality related to audio playback or recording. Specific methods are not detailed in this index. ```python from plyer import audio # Example usage: # audio.play('path/to/audio.mp3') # audio.record('path/to/output.wav') ``` -------------------------------- ### Using Maps Functionality with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet illustrates how to use the Maps facade from plyer.facades to open map applications. It supports opening locations by address or by latitude/longitude coordinates, and routing. ```python from plyer import facades # Open maps by address facades.Maps.open_by_address('1600 Amphitheatre Parkway, Mountain View, CA') # Open maps by latitude and longitude facades.Maps.open_by_lat_long(37.422, -122.084) # Request a route facades.Maps.route('1 Infinite Loop, Cupertino, CA', '1600 Amphitheatre Parkway, Mountain View, CA') ``` -------------------------------- ### Camera Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to the device's camera. This is a proxy to the Camera facade. ```Python plyer.camera ``` -------------------------------- ### Plyer Camera API Source: https://plyer.readthedocs.io/en/latest/genindex Provides access to the device's camera for capturing images or video. Specific methods are not detailed in this index. ```python from plyer import camera # Example usage: # camera.take_picture('path/to/save.jpg') ``` -------------------------------- ### Text to Speech (TTS) Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to use the Text to Speech functionality to convert text into spoken audio. It requires the `tts` module and platform support. ```Python from plyer import tts # Speak a given text tts.speak('Hello, this is Plyer speaking.') ``` -------------------------------- ### Accessing CPU Information with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to access CPU information using the plyer.facades.CPU property. It allows retrieval of logical and physical core counts, and checks for NUMA architecture. ```python from plyer import facades # Get logical CPU count logical_cores = facades.CPU.logical # Get physical CPU count physical_cores = facades.CPU.physical # Check for NUMA support is_numa = facades.CPU.numa ``` -------------------------------- ### Send Emails Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to compose and send emails using the device's default email client. It requires the `email` module and an email client configured on the device. ```Python from plyer import email # Compose and send an email email.send(recipient=['test@example.com'], subject='Test Email', message='This is a test message.') ``` -------------------------------- ### Plyer Bluetooth API Source: https://plyer.readthedocs.io/en/latest/genindex Handles Bluetooth functionalities, such as connecting or managing Bluetooth devices. Specific methods are not detailed in this index. ```python from plyer import bluetooth # Example usage: # bluetooth.connect('device_address') ``` -------------------------------- ### Plyer Wifi Facade Source: https://plyer.readthedocs.io/en/latest/api Manages Wi-Fi connectivity and status. Allows connecting to networks, enabling/disabling the Wi-Fi interface, disconnecting, and retrieving information about available networks and connection status. ```python from plyer import wifi # Enable the Wi-Fi interface wifi.enable() # Disable the Wi-Fi interface wifi.disable() # Start scanning for available Wi-Fi networks wifi.start_scanning() # Get a list of available Wi-Fi networks available_networks = wifi.get_available_wifi() print(f"Available networks: {available_networks}") # Get information about a specific network if available_networks: network_info = wifi.get_network_info(available_networks[0]) print(f"Network info: {network_info}") # Check if connected to a network is_connected = wifi.is_connected() print(f"Is connected: {is_connected}") # Disconnect from the current network wifi.disconnect() # Connect to a network (example parameters) # wifi.connect(network='MyNetwork', parameters={'password': 'mypassword'}) ``` -------------------------------- ### Storage Path Retrieval Source: https://plyer.readthedocs.io/en/latest/api Utility for retrieving standard directory paths on the device. Includes methods for application directory, documents, downloads, external storage, home directory, music, pictures, root, SD card, and videos. ```Python from plyer import storagepath # Get various storage paths app_dir = storagepath.get_application_dir() doc_dir = storagepath.get_documents_dir() downloads_dir = storagepath.get_downloads_dir() ext_storage_dir = storagepath.get_external_storage_dir() home_dir = storagepath.get_home_dir() music_dir = storagepath.get_music_dir() pictures_dir = storagepath.get_pictures_dir() root_dir = storagepath.get_root_dir() sdcard_dir = storagepath.get_sdcard_dir() videos_dir = storagepath.get_videos_dir() print(f"Application Directory: {app_dir}") print(f"Documents Directory: {doc_dir}") print(f"Downloads Directory: {downloads_dir}") print(f"External Storage Directory: {ext_storage_dir}") print(f"Home Directory: {home_dir}") print(f"Music Directory: {music_dir}") print(f"Pictures Directory: {pictures_dir}") print(f"Root Directory: {root_dir}") print(f"SD Card Directory: {sdcard_dir}") print(f"Videos Directory: {videos_dir}") ``` -------------------------------- ### Managing Orientation with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to manage the device's screen orientation using the plyer.facades.Orientation class. It includes methods to set the orientation to landscape or portrait, and to set sensor-based orientation. ```python from plyer import facades # Set orientation to landscape facades.Orientation.set_landscape() # Set orientation to portrait facades.Orientation.set_portrait() # Set orientation based on sensor facades.Orientation.set_sensor() ``` -------------------------------- ### Text-to-Speech (TTS) with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to use the Text-to-Speech (TTS) functionality with the plyer.facades.TTS class. It includes a method to speak text aloud. ```python from plyer import facades # Speak text facades.TTS.speak('Hello, this is a test.') ``` -------------------------------- ### Access Bluetooth Functionality Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to interact with Bluetooth features, such as enabling/disabling Bluetooth or scanning for devices. It requires the `bluetooth` module and platform support. ```Python from plyer import bluetooth # Example: Enable Bluetooth bluetooth.enable() # Example: Scan for devices (implementation specific) # devices = bluetooth.scan() ``` -------------------------------- ### Wifi Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to Wi-Fi functionalities. This is a proxy to the Wifi facade. ```Python plyer.wifi ``` -------------------------------- ### Speech to Text (STT) Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to use the Speech to Text functionality to convert spoken audio into text. It requires the `stt` module and platform support. ```Python from plyer import stt # Start listening for speech # stt.start() # Stop listening and get recognized text # recognized_text = stt.stop() # print(f"Recognized Text: {recognized_text}") ``` -------------------------------- ### CPU Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides information about the device's processors. This is a proxy to the CPU facade. ```Python plyer.cpu ``` -------------------------------- ### Vibrator Control with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to control the device's vibrator using the plyer.facades.Vibrator class. It includes a method to trigger vibration. ```python from plyer import facades # Vibrate the device facades.Vibrator.vibrate(time=0.5) # Vibrate for 0.5 seconds ``` -------------------------------- ### Call Functionality Source: https://plyer.readthedocs.io/en/latest/api Initiate phone calls using the device's calling interface. You can open the dialing interface or directly make a call to a specified number. ```Python from plyer import call # Open the dialing interface call.dialcall() # Make a call to a specific number # call.makecall(tel='+1234567890') ``` -------------------------------- ### Accessing Processors Information with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to access information about the device's processors using the plyer.facades.Processors property. It provides details about the processor status. ```python from plyer import facades # Get processor status information processor_status = facades.Processors.status ``` -------------------------------- ### Flash Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to the device's flash (e.g., camera flash). This is a proxy to the Flash facade. ```Python plyer.flash ``` -------------------------------- ### Control Vibration Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to control the device's vibration motor. It requires the `vibrator` module and a vibration motor. ```Python from plyer import vibrator # Vibrate for a duration (in seconds) vibrator.vibrate(duration=1.0) # Stop vibration # vibrator.cancel() ``` -------------------------------- ### Vibrator Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to the device's vibrator. This is a proxy to the Vibrator facade. ```Python plyer.vibrator ``` -------------------------------- ### Control LED Flash Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to control the device's LED flash (torch). It requires the `flash` module and a camera flash LED. ```Python from plyer import flash # Turn on the flash flash.on() # Turn off the flash # flash.off() # Toggle the flash # flash.toggle() ``` -------------------------------- ### Send Email with Plyer Source: https://plyer.readthedocs.io/en/latest/api Opens an email client message send window, pre-populated with recipient, subject, and text. Optionally, a program chooser can be displayed on Android. ```Python from plyer import email email.send( recipient='example@example.com', subject='My Subject', text='This is the email body.', create_chooser=True # Optional: For Android only ) ``` -------------------------------- ### Text-to-Speech Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to text-to-speech functionality. This is a proxy to the TTS facade. ```Python plyer.tts ``` -------------------------------- ### Sending Notifications with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet shows how to send notifications to the user using the plyer.facades.Notification class. It includes a method to trigger a notification. ```python from plyer import facades # Send a notification facades.Notification.notify(title='New Message', message='You have a new message.') ``` -------------------------------- ### Orientation Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to orientation sensor data. This is a proxy to the Orientation facade. ```Python plyer.orientation ``` -------------------------------- ### Control Screen Brightness Source: https://plyer.readthedocs.io/en/latest/index This snippet shows how to control the device's screen brightness. It requires the `brightness` module and appropriate permissions. ```Python from plyer import brightness # Set brightness level (0.0 to 1.0) brightness.set_level(0.7) # Get current brightness level current_level = brightness.get_level() print(f"Current Brightness: {current_level}") ``` -------------------------------- ### Bluetooth Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to Bluetooth functionalities. This is a proxy to the Bluetooth facade. ```Python plyer.bluetooth ``` -------------------------------- ### Access Accelerometer Sensor Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates how to access the accelerometer sensor using Plyer. It requires the `accelerometer` module to be available and provides access to acceleration data. ```Python from plyer import accelerometer # Get accelerometer data accel_data = accelerometer.acceleration print(f"Acceleration: {accel_data}") ``` -------------------------------- ### File Chooser Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to a file chooser dialog. This is a proxy to the FileChooser facade. ```Python plyer.filechooser ``` -------------------------------- ### CPU Information Retrieval Source: https://plyer.readthedocs.io/en/latest/api Obtain detailed information about the CPU, including the number of physical and logical cores, sockets, and cache details. ```Python from plyer import cpu # Get CPU physical core count physical_cores = cpu.physical print(f"Physical Cores: {physical_cores}") # Get CPU logical core count logical_cores = cpu.logical print(f"Logical Cores: {logical_cores}") # Get CPU socket count sockets = cpu.sockets print(f"Sockets: {sockets}") # Get CPU cache information cache_info = cpu.cache print(f"Cache Info: {cache_info}") # Get NUMA node count numa_nodes = cpu.numa print(f"NUMA Nodes: {numa_nodes}") ``` -------------------------------- ### Sending Email with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to send an email using the plyer.facades.Email class. It includes a method to send an email with specified recipients and subject. ```python from plyer import facades # Send an email facades.Email.send(to=['recipient@example.com'], subject='Test Email', message='This is a test email from Plyer.') ``` -------------------------------- ### Proximity Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to proximity sensor data. This is a proxy to the Proximity facade. ```Python plyer.proximity ``` -------------------------------- ### Compass Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to compass data. This is a proxy to the Compass facade. ```Python plyer.compass ``` -------------------------------- ### Plyer Flash API Source: https://plyer.readthedocs.io/en/latest/genindex Provides control over the device's flash (e.g., camera flash). Specific methods are not detailed in this index. ```python from plyer import flash # Example usage: # flash.on() # flash.off() ``` -------------------------------- ### Processors Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides information about the device's processors. This is a proxy to the Processors facade. ```Python plyer.processors ``` -------------------------------- ### Storage Path Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to storage paths on the device. This is a proxy to the StoragePath facade. ```Python plyer.storagepath ``` -------------------------------- ### Accessing Barometer Data with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to access atmospheric pressure data using the plyer.facades.Barometer property. It provides the current pressure reading. ```python from plyer import facades # Get atmospheric pressure pressure_reading = facades.Barometer.pressure ``` -------------------------------- ### Speech-to-Text Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to speech-to-text functionality. This is a proxy to the STT facade. ```Python plyer.stt ``` -------------------------------- ### Camera Video Capture Source: https://plyer.readthedocs.io/en/latest/api Record a video using the device's camera. The recorded video is saved to a specified filename, and a callback function is executed upon completion. ```Python from plyer import camera def on_video_recorded(filename): print(f"Video recorded and saved to: {filename}") # Return True to delete the file after callback return False # Record a video and save it to 'video.mp4' camera.take_video(filename='video.mp4', on_complete=on_video_recorded) ``` -------------------------------- ### Temperature Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to temperature sensor data. This is a proxy to the Temperature facade. ```Python plyer.temperature ``` -------------------------------- ### Screenshot Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides functionality to take screenshots. This is a proxy to the Screenshot facade. ```Python plyer.screenshot ``` -------------------------------- ### Plyer Brightness API Source: https://plyer.readthedocs.io/en/latest/genindex Allows control and retrieval of the device's screen brightness. The current_level() method is available. ```python from plyer import brightness # Example usage: # current_brightness = brightness.current_level() # print(f"Current brightness: {current_brightness}") ``` -------------------------------- ### Accessing Temperature Sensor Data with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to access temperature sensor data using the plyer.facades.Temperature property. It provides the current temperature reading. ```python from plyer import facades # Get temperature reading current_temperature = facades.Temperature.temperature ``` -------------------------------- ### Maps API Interaction Source: https://plyer.readthedocs.io/en/latest/api Provides functionality to interact with the device's default Maps application. Allows opening locations by address or latitude/longitude coordinates, and initiating navigation routes between two points. ```python from plyer import maps # Open a location by address # maps.open_by_address(address='1600 Amphitheatre Parkway, Mountain View, CA') # Open a location by latitude and longitude # maps.open_by_lat_long(latitude=37.4220, longitude=-122.0841) # Get navigation directions # maps.route(saddr='New York', daddr='Los Angeles') # Search for a query # maps.search(query='restaurants near me') ``` -------------------------------- ### Accessing Proximity Sensor Data with Plyer Source: https://plyer.readthedocs.io/en/latest/genindex This snippet demonstrates how to access proximity sensor data using the plyer.facades.Proximity property. This is typically used to detect if an object is near the device. ```python from plyer import facades # Get proximity sensor data proximity_status = facades.Proximity.proximity ``` -------------------------------- ### Gravity Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to gravity sensor data. This is a proxy to the Gravity facade. ```Python plyer.gravity ``` -------------------------------- ### Device Name Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides the device's name. This is a proxy to the DeviceName facade. ```Python plyer.devicename ``` -------------------------------- ### Humidity Proxy Source: https://plyer.readthedocs.io/en/latest/api Provides access to humidity sensor data. This is a proxy to the Humidity facade. ```Python plyer.humidity ``` -------------------------------- ### Access Barometer Sensor Source: https://plyer.readthedocs.io/en/latest/index This snippet demonstrates accessing the barometer sensor to retrieve atmospheric pressure data. It requires the `barometer` module and the device to have a barometer sensor. ```Python from plyer import barometer # Get barometer data pressure_data = barometer.pressure print(f"Pressure: {pressure_data}") ```