I have a Threaded program that runs in the background that creates one QApplication() per thread, and everytime I got a new Python Launcher icon on my dock.
开发者_C百科Is there a way to start a QApplication() without creating a dock icon on OSX?
Thanks!
There are ways to remove/disable the dock icon. See this question: "How to hide the Dock icon"
I use this Python code (after I created the QApplication
instance):
def hideMacDockIcon():
import AppKit
# https://developer.apple.com/library/mac/#documentation/AppKit/Reference/NSRunningApplication_Class/Reference/Reference.html
NSApplicationActivationPolicyRegular = 0
NSApplicationActivationPolicyAccessory = 1
NSApplicationActivationPolicyProhibited = 2
AppKit.NSApp.setActivationPolicy_(NSApplicationActivationPolicyProhibited)
The answer is here: Start a GUI process in Mac OS X without dock icon
Put the following lines before instantiating QApplication:
import AppKit
info = AppKit.NSBundle.mainBundle().infoDictionary()
info["LSBackgroundOnly"] = "1"
精彩评论