Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Application Title #15

Closed
SamuelWeiss opened this issue Jun 17, 2014 · 1 comment
Closed

Updating Application Title #15

SamuelWeiss opened this issue Jun 17, 2014 · 1 comment

Comments

@SamuelWeiss
Copy link

Sorry if this is a really silly question, but I'm looking to write a little application that periodically updates it's title in the status bar. The App.title(self, new_title) function appears to be exactly what I'm looking for, however I can't get it to work right. Here is a tiny mockup of my code:

import rumps

class AwesomeStatusBarApp(rumps.App):
    def __init__(self):
        super(AwesomeStatusBarApp, self).__init__("Awesome App")
        self.menu = ["updating"]

    @rumps.timer(1)
    def sayhi(self, _):
        super(AwesomeStatusBarApp, self).title(self,"Hi")

if __name__ == "__main__":
    AwesomeStatusBarApp().run()

However whenever I run this code I get the following error:

2014-06-17 11:27:24.676 Python[87027:1107] <type 'exceptions.TypeError'>: 'NoneType' object is not callable
2014-06-17 11:27:24.677 Python[87027:1107] (
0 CoreFoundation 0x00007fff9220025c exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8b096e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff921ffe09 -[NSException raise] + 9
3 _objc.so 0x000000010e478fbf _objc.so + 28607
4 CoreFoundation 0x00007fff9215e0f4 __forwarding
+ 452
5 CoreFoundation 0x00007fff9215dea8 _CF_forwarding_prep_0 + 120
6 Foundation 0x00007fff962c50f4 __NSFireTimer + 96
7 CoreFoundation 0x00007fff92167494 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20
8 CoreFoundation 0x00007fff92166fcf __CFRunLoopDoTimer + 1151
9 CoreFoundation 0x00007fff921d85aa __CFRunLoopDoTimers + 298
10 CoreFoundation 0x00007fff92122755 __CFRunLoopRun + 1525
11 CoreFoundation 0x00007fff92121f25 CFRunLoopRunSpecific + 309
12 HIToolbox 0x00007fff96e52a0d RunCurrentEventLoopInMode + 226
13 HIToolbox 0x00007fff96e527b7 ReceiveNextEventCommon + 479
14 HIToolbox 0x00007fff96e525bc _BlockUntilNextEventMatchingListInModeWithFilter + 65
15 AppKit 0x00007fff8e48226e _DPSNextEvent + 1434
16 AppKit 0x00007fff8e4818bb -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
17 AppKit 0x00007fff8e4759bc -[NSApplication run] + 553
18 libffi.dylib 0x00007fff93e92f9c ffi_call_unix64 + 76
19 ??? 0x00007fa084c3a5f0 0x0 + 140327398909424

Which is odd. The super call in the init function appears to work fine, however it gets some sort of NoneType error when I try and call it in a function. Is this an error? is there something more subtle going on here that I've messed up?

@jaredks
Copy link
Owner

jaredks commented Aug 10, 2014

Hi Samuel,

Rewrite sayhi method like this,

self.title = "Hi"

I wrote a short explanation for your Stackoverflow question here http://stackoverflow.com/questions/24291386/rumps-updating-application-title/25224351#25224351

Jared

@jaredks jaredks closed this as completed Aug 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants