rumps
rumps copied to clipboard
Request: update title
Hi,
unless I missed it, it seems you can only set the title during initialisation. I'd like to update it periodically.
cheers, Beau
You definitely can change the title at any time. Here's where I did so, as an example: https://github.com/Jzar/misc/blob/master/misc.py#L96
Thanks! I was missing the sender argument:
@rumps.timer(1)
def repeating_function(self,sender): #title does not change without 2nd argument?!
self.title= str(random.random())
It fails silently.
@jaredks You can close this now. =)
Hum, I relaunch this request but this code seem invalid.
Maybe I missed something but @rumps.timer
function seem to take only one parameter according to the documentation (Timer.set_callback).
When I try to use one of this function to update my title, two possible cases:
- I can't update my title but the function run every x seconds:
@rumps.timer(1)
def update_title(sender):
print("update")
- I try to use self (into a subclass of rumps.App), the function throw an exception:
@rumps.timer(1)
def update_title(self, sender):
print("update")
<class 'AttributeError'>: 'TypeError' object has no attribute 'message'
Maybe I miss something, but it's look like we can only access the Timer trough the repeating_function
.