Hello All,
I have a wxtaskbaricon I want a bubble tip to come up on. The problem is that I don’t know how to get the position of the wxtaskbaricon to know the position to put the bubble. I am programing on windows with python 2.5. I heard I could use hwnd somehow to do this. Can anyone assist?
-Tim
William Heath wrote:
Hello All,
I have a wxtaskbaricon I want a bubble tip to come up on. The problem is that I don't know how to get the position of the wxtaskbaricon to know the position to put the bubble. I am programing on windows with python 2.5. I heard I could use hwnd somehow to do this. Can anyone assist?
-Tim
I assume you mean the BalloonTip that was just recently added to wxPython? I just tried making a simple demo and came up with this:
<code>
import wx
from icon import getIcon
import wx.lib.agw.balloontip as BT
class MyTaskbarIcon(wx.TaskBarIcon):
def __init__(self):
wx.TaskBarIcon.__init__(self)
tbIcon = getIcon()
#icon = wx.Icon("pycon.ico", wx.BITMAP_TYPE_ICO)
self.SetIcon(tbIcon, "Test Program")
tipballoon = BT.BalloonTip(message="This is only a test!")
tipballoon.SetTarget(self)
tipballoon.SetStartDelay(1000)
if __name__ == "__main__":
app = wx.PySimpleApp()
tbicon = MyTaskbarIcon()
app.MainLoop()
</code>
Note that I didn't set up any handlers to close the bugger so if you're not using some kind of IDE like Wing, you'll probably have to kill it via the task manager. Anyway, I used almost all the defaults for the BalloonTip. There are a lot of others options you can use to change its appearance. See the demo for details.
This worked for me and the balloon always popped up when I moused over the taskbar icon no matter where the icon was in the system tray. I'm running Python 2.5 on Windows XP.
···
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Hi All,
I appreciate this reply and yes it does work for me as well. I have a need to display a secondary BalloonTip however. In order to do that I must know the screen coordinates of the tray icon. Is there any way to find that?
-Tim
···
On Mon, May 11, 2009 at 11:04 AM, Mike Driscoll mike@pythonlibrary.org wrote:
William Heath wrote:
Hello All,
I have a wxtaskbaricon I want a bubble tip to come up on. The problem is that I don’t know how to get the position of the wxtaskbaricon to know the position to put the bubble. I am programing on windows with python 2.5. I heard I could use hwnd somehow to do this. Can anyone assist?
-Tim
I assume you mean the BalloonTip that was just recently added to wxPython? I just tried making a simple demo and came up with this:
import wx
from icon import getIcon
import wx.lib.agw.balloontip as BT
class MyTaskbarIcon(wx.TaskBarIcon):
def __init__(self):
wx.TaskBarIcon.__init__(self)
tbIcon = getIcon()
#icon = wx.Icon("pycon.ico", wx.BITMAP_TYPE_ICO)
self.SetIcon(tbIcon, "Test Program")
tipballoon = BT.BalloonTip(message="This is only a test!")
tipballoon.SetTarget(self)
tipballoon.SetStartDelay(1000)
if __name__ == "__main__":
app = wx.PySimpleApp()
tbicon = MyTaskbarIcon()
app.MainLoop()
</code>
Note that I didn’t set up any handlers to close the bugger so if you’re not using some kind of IDE like Wing, you’ll probably have to kill it via the task manager. Anyway, I used almost all the defaults for the BalloonTip. There are a lot of others options you can use to change its appearance. See the demo for details.
This worked for me and the balloon always popped up when I moused over the taskbar icon no matter where the icon was in the system tray. I’m running Python 2.5 on Windows XP.
Mike Driscoll
Blog: http://blog.pythonlibrary.org
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Hi,
Hi All,
I appreciate this reply and yes it does work for me as well. I have a need
to display a secondary BalloonTip however. In order to do that I must know
the screen coordinates of the tray icon. Is there any way to find that?
No, as far as I know. TaskBarIcon does not provide any positioning
information, but it's not that hard to find it out yourself by
perusing the wx.EVT_TASKBAR_MOVE event and the wx.GetMousePosition()
method. You can take a look at my wx.lib.agw.balloontip implementation
for a simple way on how to do it.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On Wed, May 13, 2009 at 1:20 AM, William Heath wrote:
Hi Andrea,
It is an honor to have you reply to my thread! I love BalloonTip! My problem is the mouse is not over or clicking on the systray icon so I don’t think looking for the mouse event will work. I was told I might be able to get the handle of the icon and use that to get the coordinates. Is that possible. The sooner the better for a solution to this please I am on windows.
-Tim
···
On Wed, May 13, 2009 at 1:40 AM, Andrea Gavana andrea.gavana@gmail.com wrote:
Hi,
On Wed, May 13, 2009 at 1:20 AM, William Heath wrote:
Hi All,
I appreciate this reply and yes it does work for me as well. I have a need
to display a secondary BalloonTip however. In order to do that I must know
the screen coordinates of the tray icon. Is there any way to find that?
No, as far as I know. TaskBarIcon does not provide any positioning
information, but it’s not that hard to find it out yourself by
perusing the wx.EVT_TASKBAR_MOVE event and the wx.GetMousePosition()
method. You can take a look at my wx.lib.agw.balloontip implementation
for a simple way on how to do it.
Andrea.
“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users