Have you ever wondered how to create a simple application that uses balloons to notify about some events? Below is the result of my spike on how I could use
IronPython and Windows Forms to create such thing.

Basically, it should:
- show an icon in the system tray
NotifyIcon is a class that allows you to display an icon in the system tray.
- display a tooltip every n milliseconds
It was easily achieved by using the notifyIcon.ShowBalloonTip method and the Timer (and its Tick event) class.
- have a context menu that allows you to exit the application
The ContextMenu class.
Just paste the code to the Main.py file, prepare a test.ico file and run it with:
ipy Main.py
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
from System.Drawing import Icon
from System.Windows.Forms import (Application, ContextMenu,
MenuItem, NotifyIcon, Timer)
class Main(object):
def __init__(self):
self.initNotifyIcon()
timer = Timer()
timer.Interval = 60000
timer.Tick += self.onTick
timer.Start()
def initNotifyIcon(self):
self.notifyIcon = NotifyIcon()
self.notifyIcon.Icon = Icon("test.ico")
self.notifyIcon.Visible = True
self.notifyIcon.ContextMenu = self.initContextMenu()
def onTick(self, sender, event):
self.notifyIcon.BalloonTipTitle = "Hello, I'm IronPython"
self.notifyIcon.BalloonTipText = "Who are you?"
self.notifyIcon.ShowBalloonTip(1000)
def initContextMenu(self):
contextMenu = ContextMenu()
exitMenuItem = MenuItem("Exit")
exitMenuItem.Click += self.onExit
contextMenu.MenuItems.Add(exitMenuItem)
return contextMenu
def onExit(self, sender, event):
self.notifyIcon.Visible = False
Application.Exit()
if __name__ == "__main__":
main = Main()
Application.Run()
Update:Marcin shows how to achieve the same with Groovy.