O'Reilly logo

WxPython Application Development Cookbook by Cody Precord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying transient notifications

If your application needs to occasionally get the user's attention and present some information that may not be critical or require acknowledgement, the ToasterBox window can be a nice and unobtrusive way to show simple messages to the user. In this recipe, we will make a small TrayIcon application that acts as a timer, which pops up a notification every time a set amount of time has elapsed.

How to do it…

Here are the steps that you need to perform:

  1. First, we need an additional import from wx.lib to access ToasterBox. For this, we will uses the following code:
    import wx
    import wx.lib.agw.toasterbox as tb
    
    ID_GET_DUR = wx.NewId()
    ID_START = wx.NewId()
  2. Next, let's make a custom TaskBarIcon object to manage our alarm ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required