AtomBombed last edited by AtomBombed
I was just bored, and I decided to make something using a new module. My choice: objc_util. So, here was what I ended up doing.
# coding: utf-8 from objc_util import * from time import sleep UIScreen = ObjCClass('UIScreen') screen = UIScreen.mainScreen() while True: if screen.brightness() == 1: screen.setBrightness_(0.1) else: new = float(float(screen.brightness()) + 0.1) screen.setBrightness_(new) sleep(0.12)
Makes a repeating brightness change. Pretty interesting. Try it out!
NOTE: As you may have seen, I added the time.sleep() function, so it won't screw your battery up too bad. Before I did that, I left the program running for a minute, and I lost about 3%-4% of battery life.
JonB last edited by
For your next challenge, : can you find an operator in the standard library which will let you handle the wrapping without an if statement?
AtomBombed last edited by
Good challenge, thanks! I like when people challenge me to do things.