Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python script that turns bluetooth on

import asyncio
from winrt.windows.devices import radios


async def bluetooth_power(turn_on):
    all_radios = await radios.Radio.get_radios_async()
    for this_radio in all_radios:
        if this_radio.kind == radios.RadioKind.BLUETOOTH:
            if turn_on:
                result = await this_radio.set_state_async(radios.RadioState.ON)
            else:
                result = await this_radio.set_state_async(radios.RadioState.OFF)


if __name__ == '__main__':
    asyncio.run(bluetooth_power(False)) # if u want it On write True instead of False
Comment

PREVIOUS NEXT
Code Example
Python :: python ternary elif 
Python :: python tobytes 
Python :: To create a SparkSession 
Python :: python list add to start 
Python :: django model query join 
Python :: python list index() 
Python :: concat sort 
Python :: kdeplot python 
Python :: covariance in python 
Python :: continue in python 
Python :: Convert datetime object to a String of date only in Python 
Python :: pandas split tuple column 
Python :: flask rest api upload image 
Python :: how to get more than one longest string in a list python 
Python :: dtype array 
Python :: python timestamp to string 
Python :: array creation in numpy 
Python :: python split string with a seperator 
Python :: python keyboard input 
Python :: numpy randomly swap lines 
Python :: tensorflow neural network 
Python :: histogram for categorical data with plotly 
Python :: how to use prettytable in python 
Python :: example of break statement in python 
Python :: python get audio from video 
Python :: indentation in python 
Python :: download youtube video 
Python :: remove extra blank spaces 
Python :: python file save 
Python :: how to replace a string in py 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =