Friday 15 January 2010

windows - Python Balloon Tips won't display in XP - wx GUI -



windows - Python Balloon Tips won't display in XP - wx GUI -

i have python 2.7 windows app wx (3.0) gui features running in windows 7....but can't scheme tray icon balloon tips work in windows xp. company still in process of updating 15,000 pc's , won't finished until mid next year, want software out multiple versions until then.

i've searched week , can't seem find identical situation own, without dismantling whole programme , starting on (maybe thats need do?)... other solutions involve recreating windows win32gui instead of wx build @ foundation of app. (i have pop menu, , multiple panels open based on scheme tray menu selection). i've double checked of modules 32 bit, maybe i'm missing else?

i've taken elements other examples i've found here working in w7:

def showballoon(self, title, text, msec = 15, flags = 0): """ show balloon tooltip @param title - title balloon tooltip @param msg - balloon tooltip text @param msec - timeout balloon tooltip, in milliseconds @param flags - 1 of wx.icon_information, wx.icon_warning, wx.icon_error """ self.icon = wx.icon(os.getcwd() + "\icons\main.ico", wx.bitmap_type_ico) if win32 , self.isiconinstalled(): try: self.__setballoontip(self.icon.gethandle(), title, text, msec, flags) except exception e: pass # print(e) silent error def __setballoontip(self, hicon, title, msg, msec, flags): # translate flags print flags infoflags = 0 self.icon = wx.icon(os.getcwd() + "\icons\main.ico", wx.bitmap_type_ico) if flags & wx.icon_information: infoflags |= win32gui.niif_info elif flags & wx.icon_warning: infoflags |= win32gui.niif_warning elif flags & wx.icon_error: infoflags |= win32gui.niif_error # show balloon lpdata = (self.__geticonhandle(), # hwnd 99, # id win32gui.nif_message|win32gui.nif_info|win32gui.nif_icon, # flags: combination of nif_* flags 0, # callbackmessage: message id pass hwnd when processing messages hicon, # hicon: handle icon displayed '', # tip: tooltip text msg, # info: balloon tooltip text msec, # timeout: timeout balloon tooltip, in milliseconds title, # infotitle: title balloon tooltip infoflags # infoflags: combination of niif_* flags ) win32gui.shell_notifyicon(win32gui.nim_modify, lpdata) self.seticon(self.icon, self.tooltip) # hack: because have no access real callbackmessage value def __geticonhandle(self): """ find icon window. ugly there no way find window straight wx """ if not hasattr(self, "_chwnd"): try: handle in wx.gettoplevelwindows(): if handle.getwindowstyle(): go on handle = handle.gethandle() if len(win32gui.getwindowtext(handle)) == 0: self._chwnd = handle break if not hasattr(self, "_chwnd"): raise exception except: raise exception, "icon window not found" homecoming self._chwnd

i don't errors or exceptions in xp, balloon tips won't display. tips called based on receipt of incoming tcp messages, , display details of incoming message. much novice, give thanks in advance!

you might want seek using balloontip widget builtin wxpython. in wx.lib.agw.balloontip. doesn't quite native since custom widget, should work across multiple versions of windows fine.

you can see illustration in wxpython demo package. there short illustration here:

http://wxpython.org/phoenix/docs/html/lib.agw.balloontip.html

python windows python-2.7 winapi

No comments:

Post a Comment