How do I make my wx python app run in the background

Good day everyone,

Yes it is me again, but I am trying to work on something very useful here :).
This is what I want to accomplish and I cannot seem to figure out how. Hopefully someone can assist me.
so I am creating an app that needs to do the following:

  1. on computer startup pop up with a little window asking the user if they want to see some info which is located in the main window of the app.
    if they click no the pop up window will close and the app will minimize to tray and run in the background(much like google drive)
    if they click yes, the main window displaying the info will open, and after they finish viewing that info and close that window, it will minimize to the system tray as well.
  2. if they click on the app icon or exe file the main window should open, and if they close it should minimize to the system tray (this means that it would not be displayed as open in the taskbar but it is still active)
  3. when a certain date and time which was selected by the user comes around, a window will ppop up (like a reminder) with some info for the user (like when you take a screenshot and google drive pops up)

can anyone point me in the direction to help me achieve my goals? it would be greatly appreciated.

The wx.Frame class is the one that shows up in the taskbar. You can call .Show() or .Hide() to show or hide this frame. You can do this automatically on minimize in the wx.EVT_ICONIZE event.

You also want your wx.Frame to instantiate a wx.adv.TaskBarIcon() to show something in the system tray.
Start a wx.Timer to periodically check the time/date to see if its time to pop up.
You can also bind to the wx.EVT_TASKBAR_LEFT_DOWN event on your taskbaricon.

Example Skeleton App
import locale
try:    # wxPython
    import wx
    import wx.adv
except ImportError as err:
    print("Requires wxPython (")
    print("\tpython -m pip install wxpython")
app = wx.App(False)
locale.setlocale(locale.LC_ALL, 'C')

class MainFrame(wx.Frame):
    def __init__(self, parent=None, title="", size=wx.DefaultSize):
        wx.Frame.__init__(self, parent=parent, title=title, size=size)
        # Create task bar icon, but exit program if not available.
        self.taskBarIcon = wx.adv.TaskBarIcon()
        if self.taskBarIcon.IsAvailable() is False:
            raise SystemExit("Cannot access system tray")
        bitmap = wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_CMN_DIALOG, (32,32))
        self.taskBarIcon.SetIcon(wx.Icon(bitmap), "Tooltip")
        # Create timer and bind events
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_ICONIZE, self.OnMinimize)
        self.taskBarIcon.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.OnShowFrame)

    def OnMinimize(self, event):
        if self.IsIconized() is True:

    def OnShowFrame(self, event):
        # Restore Frame if it is minimized.
        if self.IsIconized() is True:
        # Show MainFrame if it is not shown already.
        if self.IsShown() is True:
            # Frame is already visible. Flash it.

    def OnClose(self, event):
        # Frame closed. Destroy taskbar icon and stop timer.
        if self.timer.IsRunning() is True:

# Instantiate and show frame and run event pump until user exits.
frame = MainFrame(parent=None, title="Tray Test", size=(600, 500))
1 Like

thank you very much for your assistance. God bless you!