Unable to use wx.NotificationMessage properly with wxPython

后端 未结 2 687
有刺的猬
有刺的猬 2021-01-05 14:32

I recently upgraded to the development release of wxPython (wxPython 2.9.2.4) since I needed the functionality of wx.NotificationMessage within my application. I have been t

2条回答
  •  滥情空心
    2021-01-05 14:50

    There is an undocumented hidden method in TaskBarIcon called ShowBalloon which is only implemented for Windows.

    From the source:

    def ShowBalloon(*args, **kwargs):
        """
        ShowBalloon(self, String title, String text, unsigned int msec=0, int flags=0) -> bool
    
        Show a balloon notification (the icon must have been already
        initialized using SetIcon).  Only implemented for Windows.
    
        title and text are limited to 63 and 255 characters respectively, msec
        is the timeout, in milliseconds, before the balloon disappears (will
        be clamped down to the allowed 10-30s range by Windows if it's outside
        it) and flags can include wxICON_ERROR/INFO/WARNING to show a
        corresponding icon
    
        Returns True if balloon was shown, False on error (incorrect parameters
        or function unsupported by OS)
    
        """
        return _windows_.TaskBarIcon_ShowBalloon(*args, **kwargs)
    

    I tested it on Windows with wxPython 2.9.4.0 and it works well.

提交回复
热议问题