pop up frame on application icon hover/click

Hi all,

What is the way to achieve a popup frame with textctrl to appear so
as to enter some search values when mouse hover / single click over
application icon .

Performance is an issue as window should appear instantly on hover,
should i be using normal frame object.Please point in the right
direction

Thanks
Thomas

Hi All,

I found that i could use the TaskBarIcon. I am using
wx.EVT_TASKBAR_LEFT_DOWN to popup the frame.
Is this right approach, also any pointers how to make the taskbaricon
available to user on boot up. I am using inno setup to create the
application.

Also is there something like TaskBarTextCtrl .

Thanks
Thomas

···

###################################
import wx

def OnTaskBarRight(event):
    app.ExitMainLoop()
#setup app
app= wx.PySimpleApp()

#setup icon object
icon = wx.Icon("favicon.ico", wx.BITMAP_TYPE_ICO)

#setup taskbar icon
tbicon = wx.TaskBarIcon()
tbicon.SetIcon(icon, "I am an Icon")

#add taskbar icon event
wx.EVT_TASKBAR_RIGHT_UP(tbicon, OnTaskBarRight)

app.MainLoop()
#########################################

On Jul 15, 11:21 am, thomas <tctho...@gmail.com> wrote:

Hi all,

What is the way to achieve a popup frame with textctrl to appear so
as to enter some search values when mouse hover / single click over
application icon .

Performance is an issue as window should appear instantly on hover,
should i be using normal frame object.Please point in the right
direction

Thanks
Thomas

thomas wrote:

Hi All,

I found that i could use the TaskBarIcon. I am using
wx.EVT_TASKBAR_LEFT_DOWN to popup the frame.
Is this right approach,

Yes.

also any pointers how to make the taskbaricon
available to user on boot up. I am using inno setup to create the
application.

Install a shortcut into the user's Startup start menu folder.

Also is there something like TaskBarTextCtrl .

No. Your idea of showing a frame with the content you need is the right way to approach this.

···

--
Robin Dunn
Software Craftsman

Hi Robin,

Thanks for that, much appreciate your help.

I also need to positon the frame to appear just over the taskbar on
the bottom right corner. The event doesnt have a GetPosition
attribute.

I also noticed first time even after having the focus (I see the
cursor in the textctrl)frame not accepting key board press on the
textctrl . This is not happening the next time I left click to open
it.

the code is
self.tbicon = wx.TaskBarIcon()
self.tbicon.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeft)

and

def OnTaskBarLeft(self,event):
     frame=wxFrameSearchBar.create(None)
     self.SetTopWindow(frame)
     frame.Show();

Thanks
Thomas

···

On Jul 16, 11:40 am, Robin Dunn <ro...@alldunn.com> wrote:

thomas wrote:
> Hi All,

> I found that i could use the TaskBarIcon. I am using
> wx.EVT_TASKBAR_LEFT_DOWN to popup the frame.
> Is this right approach,

Yes.

> also any pointers how to make the taskbaricon
> available to user on boot up. I am using inno setup to create the
> application.

Install a shortcut into the user's Startup start menu folder.

> Also is there something like TaskBarTextCtrl .

No. Your idea of showing a frame with the content you need is the right
way to approach this.

--
Robin Dunn
Software Craftsmanhttp://wxPython.org

Thomas,

Hi Robin,

Thanks for that, much appreciate your help.

I also need to positon the frame to appear just over the taskbar on
the bottom right corner. The event doesnt have a GetPosition
attribute.

I think you have to calculate this yourself. That's what I had to do
for a pop-up of my own. Basically all you need is the size of the
display minus the size of your application (plus or minus some buffer
pixels).

I also noticed first time even after having the focus (I see the
cursor in the textctrl)frame not accepting key board press on the
textctrl . This is not happening the next time I left click to open
it.

For this, you may need to call SetFocus on the TextCtrl.

the code is
self.tbicon = wx.TaskBarIcon()
self.tbicon.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeft)

and

def OnTaskBarLeft(self,event):
frame=wxFrameSearchBar.create(None)
self.SetTopWindow(frame)
frame.Show();

Thanks
Thomas

- Mike

···

On Jul 15, 6:59 pm, thomas <tctho...@gmail.com> wrote:

On Jul 16, 11:40 am, Robin Dunn <ro...@alldunn.com> wrote:

Mike Driscoll wrote:

Thomas,

Hi Robin,

Thanks for that, much appreciate your help.

I also need to positon the frame to appear just over the taskbar on
the bottom right corner. The event doesnt have a GetPosition
attribute.

I think you have to calculate this yourself. That's what I had to do
for a pop-up of my own. Basically all you need is the size of the
display minus the size of your application (plus or minus some buffer
pixels).

That doesn't work if the taskbar is someplace besides the bottom of the screen. On windows you can figure out which side of the screen has the taskbar by calling wx.GetClientDisplayRect() and comparing that rectangle to wx.GetDisplaySize.

···

On Jul 15, 6:59 pm, thomas <tctho...@gmail.com> wrote:

--
Robin Dunn
Software Craftsman

Robin,

···

On Jul 16, 2:39 pm, Robin Dunn <ro...@alldunn.com> wrote:

Mike Driscoll wrote:
> Thomas,

> On Jul 15, 6:59 pm, thomas <tctho...@gmail.com> wrote:
>> Hi Robin,

>> Thanks for that, much appreciate your help.

>> I also need to positon the frame to appear just over the taskbar on
>> the bottom right corner. The event doesnt have a GetPosition
>> attribute.

> I think you have to calculate this yourself. That's what I had to do
> for a pop-up of my own. Basically all you need is the size of the
> display minus the size of your application (plus or minus some buffer
> pixels).

That doesn't work if the taskbar is someplace besides the bottom of the
screen. On windows you can figure out which side of the screen has the
taskbar by calling wx.GetClientDisplayRect() and comparing that
rectangle to wx.GetDisplaySize.

--
Robin Dunn
Software Craftsmanhttp://wxPython.org

Drat! I keep forgetting that some people just can't leave the taskbar
alone. Although I think it will still put the popup in almost the same
spot...oh well.

- Mike

Thank you so much Mike & Robin I got it all working fine.

···

On Jul 17, 7:47 am, Mike Driscoll <kyoso...@gmail.com> wrote:

Robin,

On Jul 16, 2:39 pm, Robin Dunn <ro...@alldunn.com> wrote:

> Mike Driscoll wrote:
> > Thomas,

> > On Jul 15, 6:59 pm, thomas <tctho...@gmail.com> wrote:
> >> Hi Robin,

> >> Thanks for that, much appreciate your help.

> >> I also need to positon the frame to appear just over the taskbar on
> >> the bottom right corner. The event doesnt have a GetPosition
> >> attribute.

> > I think you have to calculate this yourself. That's what I had to do
> > for a pop-up of my own. Basically all you need is the size of the
> > display minus the size of your application (plus or minus some buffer
> > pixels).

> That doesn't work if the taskbar is someplace besides the bottom of the
> screen. On windows you can figure out which side of the screen has the
> taskbar by calling wx.GetClientDisplayRect() and comparing that
> rectangle to wx.GetDisplaySize.

> --
> Robin Dunn
> Software Craftsmanhttp://wxPython.org

Drat! I keep forgetting that some people just can't leave the taskbar
alone. Although I think it will still put the popup in almost the same
spot...oh well.

- Mike

>I also noticed first time even after having the focus (I see the
>cursor in the textctrl)frame not accepting key board press on the
>textctrl . This is not happening the next time I left click to open

it.

For this, you may need to call SetFocus on the TextCtrl.

This is still no accepting key press. If i close and open the frame
again it works fine.
It's only happening the very first time.

···

On Jul 17, 4:19 pm, thomas <tctho...@gmail.com> wrote:

Thank you so much Mike & Robin I got it all working fine.

On Jul 17, 7:47 am, Mike Driscoll <kyoso...@gmail.com> wrote:

> Robin,

> On Jul 16, 2:39 pm, Robin Dunn <ro...@alldunn.com> wrote:

> > Mike Driscoll wrote:
> > > Thomas,

> > > On Jul 15, 6:59 pm, thomas <tctho...@gmail.com> wrote:
> > >> Hi Robin,

> > >> Thanks for that, much appreciate your help.

> > >> I also need to positon the frame to appear just over the taskbar on
> > >> the bottom right corner. The event doesnt have a GetPosition
> > >> attribute.

> > > I think you have to calculate this yourself. That's what I had to do
> > > for a pop-up of my own. Basically all you need is the size of the
> > > display minus the size of your application (plus or minus some buffer
> > > pixels).

> > That doesn't work if the taskbar is someplace besides the bottom of the
> > screen. On windows you can figure out which side of the screen has the
> > taskbar by calling wx.GetClientDisplayRect() and comparing that
> > rectangle to wx.GetDisplaySize.

> > --
> > Robin Dunn
> > Software Craftsmanhttp://wxPython.org

> Drat! I keep forgetting that some people just can't leave the taskbar
> alone. Although I think it will still put the popup in almost the same
> spot...oh well.

> >- Mike

Thomas,

···

On Jul 16, 11:46 pm, thomas <tctho...@gmail.com> wrote:

> >I also noticed first time even after having the focus (I see the
> >cursor in the textctrl)frame not accepting key board press on the
> >textctrl . This is not happening the next time I left click to open
>> it.
>For this, you may need to call SetFocus on the TextCtrl.

This is still no accepting key press. If i close and open the frame
again it works fine.
It's only happening the very first time.

Can you produce a small runnable sample for us to play with?

Mike

Hi Mike,

I have a made a small application please find the code below..

···

#############################################
import wx

[wxID_FRAME1, wxID_FRAME1PANEL1, wxID_FRAME1TEXTCTRL1,
] = [wx.NewId() for _init_ctrls in range(3)]

class Frame1(wx.Frame):
    def _init_sizers(self):
        # generated method, don't edit
        self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)

        self._init_coll_boxSizer1_Items(self.boxSizer1)

        self.SetSizer(self.boxSizer1)

    def _init_coll_boxSizer1_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.panel1, 1, border=0, flag=wx.EXPAND)

    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(365, 321), size=wx.Size(322, 167),
              style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
        self.SetClientSize(wx.Size(314, 133))

        self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1',
parent=self,
              pos=wx.Point(0, 0), size=wx.Size(314, 133),
              style=wx.TAB_TRAVERSAL)

        self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL1,
name='textCtrl1',
              parent=self.panel1, pos=wx.Point(64, 56), size=wx.Size
(100, 21),
              style=0, value=u'')

        self._init_sizers()

    def __init__(self, parent):
        self._init_ctrls(parent)
        self.textCtrl1.SetFocus()

def OnTaskBarRight(event):
    app.ExitMainLoop()

def OnTaskBarLeft(event):
    main=Frame1(None)
    app.SetTopWindow(main)
    main.Show();
#setup app
app= wx.PySimpleApp()

#setup icon object
icon = wx.Icon("favicon.ico", wx.BITMAP_TYPE_ICO)

#setup taskbar icon
tbicon = wx.TaskBarIcon()
tbicon.SetIcon(icon, "I am an Icon")

#add taskbar icon event
wx.EVT_TASKBAR_RIGHT_UP(tbicon, OnTaskBarRight)
tbicon.Bind(wx.EVT_TASKBAR_LEFT_DOWN, OnTaskBarLeft)

app.MainLoop()

Thanks
Thomas

On Jul 18, 1:20 am, Mike Driscoll <kyoso...@gmail.com> wrote:

Thomas,

On Jul 16, 11:46 pm, thomas <tctho...@gmail.com> wrote:

> > >I also noticed first time even after having the focus (I see the
> > >cursor in the textctrl)frame not accepting key board press on the
> > >textctrl . This is not happening the next time I left click to open
> >> it.
> >For this, you may need to call SetFocus on the TextCtrl.

> This is still no accepting key press. If i close and open the frame
> again it works fine.
> It's only happening the very first time.

Can you produce a small runnable sample for us to play with?

Mike

Hi Thomas,

···

On Jul 19, 5:10 pm, thomas <tctho...@gmail.com> wrote:

Hi Mike,

I have a made a small application please find the code below..
#############################################
import wx

[wxID_FRAME1, wxID_FRAME1PANEL1, wxID_FRAME1TEXTCTRL1,
] = [wx.NewId() for _init_ctrls in range(3)]

class Frame1(wx.Frame):
def _init_sizers(self):
# generated method, don't edit
self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)

    self\.\_init\_coll\_boxSizer1\_Items\(self\.boxSizer1\)

    self\.SetSizer\(self\.boxSizer1\)

def \_init\_coll\_boxSizer1\_Items\(self, parent\):
    \# generated method, don&#39;t edit

    parent\.AddWindow\(self\.panel1, 1, border=0, flag=wx\.EXPAND\)

def \_init\_ctrls\(self, prnt\):
    \# generated method, don&#39;t edit
    wx\.Frame\.\_\_init\_\_\(self, id=wxID\_FRAME1, name=&#39;&#39;, parent=prnt,
          pos=wx\.Point\(365, 321\), size=wx\.Size\(322, 167\),
          style=wx\.DEFAULT\_FRAME\_STYLE, title=&#39;Frame1&#39;\)
    self\.SetClientSize\(wx\.Size\(314, 133\)\)

    self\.panel1 = wx\.Panel\(id=wxID\_FRAME1PANEL1, name=&#39;panel1&#39;,

parent=self,
pos=wx.Point(0, 0), size=wx.Size(314, 133),
style=wx.TAB_TRAVERSAL)

    self\.textCtrl1 = wx\.TextCtrl\(id=wxID\_FRAME1TEXTCTRL1,

name='textCtrl1',
parent=self.panel1, pos=wx.Point(64, 56), size=wx.Size
(100, 21),
style=0, value=u'')

    self\.\_init\_sizers\(\)

def \_\_init\_\_\(self, parent\):
    self\.\_init\_ctrls\(parent\)
    self\.textCtrl1\.SetFocus\(\)

def OnTaskBarRight(event):
app.ExitMainLoop()

def OnTaskBarLeft(event):
main=Frame1(None)
app.SetTopWindow(main)
main.Show();
#setup app
app= wx.PySimpleApp()

#setup icon object
icon = wx.Icon("favicon.ico", wx.BITMAP_TYPE_ICO)

#setup taskbar icon
tbicon = wx.TaskBarIcon()
tbicon.SetIcon(icon, "I am an Icon")

#add taskbar icon event
wx.EVT_TASKBAR_RIGHT_UP(tbicon, OnTaskBarRight)
tbicon.Bind(wx.EVT_TASKBAR_LEFT_DOWN, OnTaskBarLeft)

app.MainLoop()

Thanks
Thomas

I got it to work by sticking a "self.Raise()" call right before
"self._init_sizers()". My machine has Windows XP, wxPython 2.8.9.2 and
Python 2.5 on it.

- Mike