The truth is I despise windows xp balloon tips. Well, not so much the
balloon tips, but how they're used by the operating system: like I
need my system tray to tell me when there are "unused icons" on my
desktop, or that "local disk" has less than 200 mb of free space. But
I digress
I liked the way GTray told me when I had new mail using the balloon
tip, and so when I replicated the program in python for use with
Private Messages on message boards, I naturally was interested in how
to achieve the same result.
I've searched comp.lang.python, google, the python chm, and the python
for windows chm, and none of them have yielded a single result.
When the Python for Windows docs didn't have anything I figured it
just wasn't possible yet, but I decided to ask here anyway. So, does
anyone know of a way to use the Windows XP Balloon Tip feature with
python? (namely wxPython, considering that's the GUI I use)
Thanks for your time,
Daniel Bickett
Yep, very possible - we use it in one of our apps (the internal debate wrt
whether or not we should have a tray icon is another story ;-) ). If you just
need to display the balloons then you can use ctypes to call the
shell32.Shell_NotifyIconA function (Google for NotifyIcon on MSDN to learn the
gory details).
If you also want to receive messages (mouse over, click, etc.) then you'll need
to set up a message loop to handle the MSG_ICON_NOTIFY message - I used Venster
for that.
-Dave
Just out of curiosity, is there a way to do this also from PythonWin
(without having ctypes installed)?
--
.:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:.
"talking about music is like dancing about architecture."
I haven't used pywin32 in a long time, but ASPN says Shell_NotifyIcon is supported:
http://aspn.activestate.com/ASPN/docs/ActivePython/2.2/PyWin32/win32gui.html
So: probably doable, haven't tried it though.
-Dave
> Dave Benjamin,
>
>> Just out of curiosity, is there a way to do this also from PythonWin
>> (without having ctypes installed)?
>
> the game is called "AnimateWindow".
> I posted a ctypes-programm to pywin32 mailinglist two weeks ago. It just
> was not robust enough to go into the wiki.
You forgot to keep a reference to the callback function - a very common
error. I hope to make this much easier in the next ctypes version,
where ctypes does this itself automatically.
>
> With build 203 Python win32 extension by Mark Hammond also wrap the
> AnimateWindow function (on XP), but they came out yesterday so I just read
> the change notes that they do; did not find a demo. So... please download
> pywin32 and try :)))
Thomas
I could be wrong, but I don't think that you need to use AnimateWindow
to do a balloon tip. In recent versions of PyWin32 a simple call to
win32gui.Shell_NotifyIcon is all you need.
> With build 203 Python win32 extension by Mark Hammond also wrap the
> AnimateWindow function (on XP), but they came out yesterday so I just read
> the change notes that they do; did not find a demo. So... please download
> pywin32 and try :)))
I modified a taskbar icon demo (from
http://www.itamarst.org/software/) the other day to add a balloon tip
to it. I have the modified demo available at
http://www.dowski.com/python/taskbardemo.py.
Christian