button does not fire event in special situation

Hi,
I noticed that a button does not fire an event in case the mouse pointer is
directly over the button while its status is being changed from disabled to
enabled. The button is activated however as indicated by the dashed frame drawn
around the button label. If the mouse is moved by just one pixel after the button
has been enabled, everything works as expected.
This happens on linux, wxPython 2.6.3.3 and 2.8.0.1.
See the example below. Move the mouse over the button and wait that the button
is enabled (after 2 seconds).

import wxversion
wxversion.select('2.8')
import wx
print wx.__version__

class Frame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, size=(300,300))
        pan = wx.Panel(self, -1)
        self.btn = wx.Button(pan, -1, 'click me', pos=(100,100))
        self.btn.Disable()

        self.Bind(wx.EVT_TIMER, self.OnShow)
        self.btn.Bind(wx.EVT_BUTTON, self.OnClick)
        
        self.timer = wx.Timer(self)
        self.timer.Start(2000,wx.TIMER_ONE_SHOT)
        
    def OnShow(self, evt):
        self.btn.Enable()

    def OnClick(self, evt):
        print evt
        
app = wx.PySimpleApp(0)
frame = Frame()
frame.Show()
app.MainLoop()

Christian

Christian Kristukat wrote:

Hi,
I noticed that a button does not fire an event in case the mouse pointer is
directly over the button while its status is being changed from disabled to
enabled. The button is activated however as indicated by the dashed frame drawn
around the button label. If the mouse is moved by just one pixel after the button
has been enabled, everything works as expected.
This happens on linux, wxPython 2.6.3.3 and 2.8.0.1.
See the example below. Move the mouse over the button and wait that the button
is enabled (after 2 seconds).

I've noticed this in other apps too, and I think that it is a GTK issue.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi,

Using wx.grid.EVT_GRID_RANGE_SELECT with wx.grid
I got this warning::
    C:\Python24\lib\site-packages\wx-2.8-msw-ansi\wx\grid.py:1140:
    DeprecationWarning: asTuple is deprecated, use `Get` instead
    def __getitem__(self, index): return self.asTuple()[index]

By replacing self.asTuple()[index] to self.Get() in grid.py the warning disappeared.

I just thought someone would find this useful.

Laszlo

i want to have grid cells look the same as a button, with the apperance of them depressing when clicked and a gap between each cell, any one got some tips on how to achieve this or done it in the past?

Timothy Smith wrote:

i want to have grid cells look the same as a button, with the apperance of them depressing when clicked and a gap between each cell, any one got some tips on how to achieve this or done it in the past?

One way would be to make a cell renderer class that uses the wx.NativeRenderer.DrawPushButton method to draw something that looks like a native button.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!