Hi,
Can one create a tooltip on a grid cell, that will stay on - as long
as the cursor is in that cell ?
Thanks,
Ron.
Hi Ron,
Hi,
Can one create a tooltip on a grid cell, that will stay on - as long
as the cursor is in that cell ?
Thanks,
Ron.
This should be possible, but you'll have to keep track of your mouse
position. Here's how to get the mouse for the grid:
self.myGridObj.GetGridWindow().Bind(wx.EVT_MOTION, self.onMouseOver)
Then you can get the x/y coordinates like this (in your handler):
x, y = self.totals_sheet.CalcUnscrolledPosition(event.GetX(),event.GetY
())
This gives you the row and column:
coords = self.myGridObj.XYToCell(x, y)
row = coords[0]
col = coords[1]
Then you just use some conditional statements (i.e. if/else) to tell
if you're in the right place:
<code>
# untested
if row == someNum and col == anotherNum:
event.GetEventObject().SetToolTipString("my tooltip")
else:
event.GetEventObject().SetToolTipString('')
</code>
I do something very similar in one of my applications.
···
On Oct 26, 11:40 am, Ron Barak <wxpython-users.comve...@9ox.net> wrote:
-------------------
Mike Driscoll
See wx.TipWindow
···
On 10/26/09 9:40 AM, Ron Barak wrote:
Hi,
Can one create a tooltip on a grid cell, that will stay on - as long
as the cursor is in that cell ?
--
Robin Dunn
Software Craftsman
Googling didn't produce any helpful examples, and I'm having problems
telling wx.TipWindow the grid header cell it has to service.
Could you point me in a direction of a working example of
wx.TipWindow ?
···
On Oct 26, 11:53 pm, Robin Dunn <ro...@alldunn.com> wrote:
On 10/26/09 9:40 AM, Ron Barak wrote:
> Hi,
> Can one create atooltipon a grid cell, that will stay on - as long
> as the cursor is in that cell ?See wx.TipWindow
--
Robin Dunn
Software Craftsmanhttp://wxPython.org
I need to give tooltips both to grid cells and to grid headers. The
wxPython tooltips allow my to do both with relative easiness.
The only problem I have is that the default OS timeout (5 seconds on
Windows?) is too short for lengthy tooltips, and I'd like to make it
much longer or eliminate the timeout altogether.
Did you implement your solution for grid headers ?
···
On Oct 26, 11:18 pm, Mike Driscoll <kyoso...@gmail.com> wrote:
Hi Ron,
On Oct 26, 11:40 am, Ron Barak <wxpython-users.comve...@9ox.net> > wrote:
> Hi,
> Can one create atooltipon a grid cell, that will stay on - as long
> as the cursor is in that cell ?
> Thanks,
> Ron.This should be possible, but you'll have to keep track of your mouse
position. Here's how to get the mouse for the grid:self.myGridObj.GetGridWindow().Bind(wx.EVT_MOTION, self.onMouseOver)
Then you can get the x/y coordinates like this (in your handler):
x, y = self.totals_sheet.CalcUnscrolledPosition(event.GetX(),event.GetY
())This gives you the row and column:
coords = self.myGridObj.XYToCell(x, y)
row = coords[0]
col = coords[1]Then you just use some conditional statements (i.e. if/else) to tell
if you're in the right place:<code>
# untested
if row == someNum and col == anotherNum:
event.GetEventObject().SetToolTipString("mytooltip")
else:
event.GetEventObject().SetToolTipString('')</code>
I do something very similar in one of my applications.
-------------------
Mike Driscoll
I've never used the TipWindow. Here's a link to a thread that looks
helpful though:
Andrea's SuperToolTip might be useful too. It's been included in the
last couple of wxPython releases. The demo has an example of its
usage.
···
On Oct 27, 4:24 am, Ron Barak <wxpython-users.comve...@9ox.net> wrote:
On Oct 26, 11:53 pm, Robin Dunn <ro...@alldunn.com> wrote:
> On 10/26/09 9:40 AM, Ron Barak wrote:
> > Hi,
> > Can one create atooltipon a grid cell, that will stay on - as long
> > as the cursor is in that cell ?> See wx.TipWindow
> --
> Robin Dunn
> Software Craftsmanhttp://wxPython.orgGoogling didn't produce any helpful examples, and I'm having problems
telling wx.TipWindow the grid header cell it has to service.
Could you point me in a direction of a working example of
wx.TipWindow ?
-------------------
Mike Driscoll
> Hi Ron,
> > Hi,
> > Can one create atooltipon a grid cell, that will stay on - as long
> > as the cursor is in that cell ?
> > Thanks,
> > Ron.> This should be possible, but you'll have to keep track of your mouse
> position. Here's how to get the mouse for the grid:> self.myGridObj.GetGridWindow().Bind(wx.EVT_MOTION, self.onMouseOver)
> Then you can get the x/y coordinates like this (in your handler):
> x, y = self.totals_sheet.CalcUnscrolledPosition(event.GetX(),event.GetY
> ())> This gives you the row and column:
> coords = self.myGridObj.XYToCell(x, y)
> row = coords[0]
> col = coords[1]> Then you just use some conditional statements (i.e. if/else) to tell
> if you're in the right place:> <code>
> # untested
> if row == someNum and col == anotherNum:
> event.GetEventObject().SetToolTipString("mytooltip")
> else:
> event.GetEventObject().SetToolTipString('')> </code>
> I do something very similar in one of my applications.
> -------------------
> Mike Driscoll> Blog: http://blog.pythonlibrary.org
I need to give tooltips both to grid cells and to grid headers. The
wxPython tooltips allow my to do both with relative easiness.
The only problem I have is that the default OS timeout (5 seconds on
Windows?) is too short for lengthy tooltips, and I'd like to make it
much longer or eliminate the timeout altogether.
Hmmm...I guess mine do disappear...but since I have it bound to mouse
movement, the timer must be getting reset so I didn't notice until I
took my hand off the mouse. The SuperToolTip might obviate this issue.
Did you implement your solution for grid headers ?
As for column header, I had a slightly different solution where I
basically calculated the location of each column I needed and then did
this:
self.myGrid.GetGridColLabelWindow().SetToolTipString('some string')
There may be a way to use "self.myGrid.GetGridColLabelWindow()" to get
the column you want (or maybe you can use the other method in my
original reply) and attach the SuperToolTip to it.
I wrote my application before I was aware of SuperToolTip (or it might
have been before it existed), otherwise I would show you how to use it
instead.
···
On Oct 27, 4:31 am, Ron Barak <wxpython-users.comve...@9ox.net> wrote:
On Oct 26, 11:18 pm, Mike Driscoll <kyoso...@gmail.com> wrote:
> On Oct 26, 11:40 am, Ron Barak <wxpython-users.comve...@9ox.net> > > wrote:
-------------------
Mike Driscoll
You don't tell wx.TipWindow anything like that, it has no idea what context you want to use it in. Instead you should respond to mouse events in the grid window or grid label windows and create a wx.TipWindow as needed.
···
On 10/27/09 2:24 AM, Ron Barak wrote:
On Oct 26, 11:53 pm, Robin Dunn<ro...@alldunn.com> wrote:
On 10/26/09 9:40 AM, Ron Barak wrote:
Hi,
Can one create atooltipon a grid cell, that will stay on - as long
as the cursor is in that cell ?See wx.TipWindow
--
Robin Dunn
Software Craftsmanhttp://wxPython.orgGoogling didn't produce any helpful examples, and I'm having problems
telling wx.TipWindow the grid header cell it has to service.
--
Robin Dunn
Software Craftsman