Jul 20

Here is another nifty tidbit of python code that is often hard to find. If you work with Python and wxPython to build gui apps, there are a number of widgets etc., that can be hard to figure out. Adding a task bar icon for your app is one of them. This simple example shows you how to add a taskbar icon, and capture events from it.
import wx
def OnTaskBarRight(event):
app.ExitMainLoop()
#setup app
app= wx.PySimpleApp()
#setup icon object
icon = wx.Icon("favicon.ico", wx.BITMAP_TYPE_ICO)
#setup taskbar icon
tbicon = wx.TaskBarIcon()
tbicon.SetIcon(icon, "I am an Icon")
#add taskbar icon event
wx.EVT_TASKBAR_RIGHT_UP(tbicon, OnTaskBarRight)
app.MainLoop()
Check out the documentation for wxPython, for more information.
Add New Comment
Viewing 1 Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks