Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9269919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:14:34+00:00 2026-06-18T15:14:34+00:00

Here is the slightly modified source code for an example tray icon application I

  • 0

Here is the slightly modified source code for an example tray icon application I found on SO:

import wx

TRAY_TOOLTIP = 'System Tray Demo'
TRAY_ICON = 'icon.png'

def create_menu_item(menu, label, func):
    item = wx.MenuItem(menu, -1, label)
    menu.Bind(wx.EVT_MENU, func, id=item.GetId())
    menu.AppendItem(item)
    return item

class TaskBarIcon(wx.TaskBarIcon):
    def __init__(self):
        super(TaskBarIcon, self).__init__()
        self.set_icon(TRAY_ICON)
        self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.on_left_down)
    def CreatePopupMenu(self):
        menu = wx.Menu()
        create_menu_item(menu, 'Say Hello', self.on_hello)
        menu.AppendSeparator()
        create_menu_item(menu, 'Exit', self.on_exit)
        return menu
    def set_icon(self, path):
        icon = wx.IconFromBitmap(wx.Bitmap(path))
        self.SetIcon(icon, TRAY_TOOLTIP)
    def on_left_down(self, event):
        print 'Tray icon was left-clicked.'
    def on_hello(self, event):
        print 'Hello, world!'
    def on_exit(self, event):
        wx.CallAfter(self.Destroy)

class App(wx.App):
    def OnInit(self):
        self.SetTopWindow(wx.Frame(None, -1))
        TaskBarIcon()

        return True

def main():
    app = App()
    app.MainLoop()

if __name__ == '__main__':
    main()

It shows a tray icon successfully, and indeed shows no Frame, but it does show the Python icon in the Dock. I assume it will also show a Python icon in the Windows task bar. How do I stop that from happening?

I’m using wxPython 2.9 on Python 2.7 on OSX Mountain Lion


enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:14:35+00:00Added an answer on June 18, 2026 at 3:14 pm

    You should create a bundle from Your application and tell specify that your app is kind of “background”, so it shall not show icon in dock.

    To do this, You have to following property to Your bundle property file (Info.plist).

    <key>LSUIElement</key>
    <string>1</string>
    

    See following articles:

    • how to create app bundle: Building OSX App Bundle
    • how hide app from “dock”: http://www.macosxtips.co.uk/index_files/disable-the-dock-icon-for-any-application.php

    • Apple reference about launch properties of application: http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my example. I'm using a slightly modified version of the selectbox plugin. One
I found the following test (slightly modified) as an answer here. But I get
Here is the code in a function I'm trying to revise. This example works
I have the following code slightly modified from the Visual Studio 2010 css template.
Referring to a slightly modified version of a jqGrid local editing demo by user
I am trying to use a slightly modified version of this code to show/hide
I have been working with some code I found here to help me with
I am using the Android Hackbook app. I have slightly modified the code to
I am using a slightly modified version of this code . to create a
Given this code snippet that can be readily pasted into Linqpad (or slightly modified

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.