简体   繁体   中英

How to make a status bar icon with retina support in Python?

I make an icon using these codes:

self.statusbar = NSStatusBar.systemStatusBar()
self.statusitem = self.statusbar.statusItemWithLength_(NSVariableStatusItemLength)
self.image = NSImage.alloc().initWithData_(IMAGE_DATA)
self.statusitem.setImage_(self.image)

But it is very ugly on Macbook Pro with Retina Display.

How can I make the status bar icon support retina display in Python?

The same as with Objecive-C: make sure the image object contains a retina representation of the image. The easiest way to do this is use named images (base.png and base@2x.png in the resources folder, then use a named NSImage)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM