rumps icon indicating copy to clipboard operation
rumps copied to clipboard

Request: update title

Open B3AU opened this issue 9 years ago • 4 comments

Hi,

unless I missed it, it seems you can only set the title during initialisation. I'd like to update it periodically.

cheers, Beau

B3AU avatar Jul 19 '15 13:07 B3AU

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

malikoth avatar Jul 21 '15 16:07 malikoth

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.

B3AU avatar Jul 22 '15 14:07 B3AU

@jaredks You can close this now. =)

malikoth avatar Aug 18 '15 00:08 malikoth

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.

avallete avatar Nov 15 '16 15:11 avallete