Hello,
I encountered some strange behaviour of a couple of RadioTools ina wxToolBar. The EVT_TOOL events are sent only every second time if you keep clicking on the same tool. However if you just clicked one tool without having recieved the event and then click on another both events are sent simultaneous. Is this a known bug or a feature?
Regards, Christian
Christian Kristukat wrote:
Hello,
I encountered some strange behaviour of a couple of RadioTools ina wxToolBar. The EVT_TOOL events are sent only every second time if you keep clicking on the same tool. However if you just clicked one tool without having recieved the event and then click on another both events are sent simultaneous. Is this a known bug or a feature?
It's probably a bug.
Platform, verion, runnable sample?
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Robin Dunn wrote:
I encountered some strange behaviour of a couple of RadioTools ina wxToolBar. The EVT_TOOL events are sent only every second time if you keep clicking on the same tool. However if you just clicked one tool without having recieved the event and then click on another both events are sent simultaneous. Is this a known bug or a feature?
It's probably a bug.
Platform, verion, runnable sample?
platform linux
wxPython.__version__ : '2.4.2.4'
Python 2.3+ (#1, Sep 23 2003, 23:07:16)
the example:
import wx
import cStringIO
def get_cross_Data():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x11\x00\x00\x00\x11\x08\x06\
\x00\x00\x00;mG\xfa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\
\x002IDATx\x9ccddbf\xc0\x07\xfe\xff\xfb\xfb\x9f\x91\x89\x99\x11\x9f\x1a&\xbc\
&\x10\tF\r\x19\xcc\x860200\xfc\xa7\xd8\x90\xd1\xc46j\x08\x11\x00\x00\xbe:\t+\
L\x05H:\x00\x00\x00\x00IEND\xaeB`\x82'
def get_cross_Bitmap():
return wx.BitmapFromImage(get_cross_Image())
def get_cross_Image():
stream = cStringIO.StringIO(get_cross_Data())
return wx.ImageFromStream(stream)
class AppFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title,
wx.PyDefaultPosition, wx.Size(200, 100))
self.CreateStatusBar()
tb = self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_TEXT|wx.NO_BORDER|wx.TB_3DBUTTONS)
tb.AddRadioTool(1, get_cross_Bitmap(), get_cross_Bitmap(), 'a', 'a')
wx.EVT_TOOL(self, 1, self.OnA)
tb.AddRadioTool(2, get_cross_Bitmap(), get_cross_Bitmap(), 'b', 'b')
wx.EVT_TOOL(self, 2, self.OnB)
tb.AddRadioTool(3, get_cross_Bitmap(), get_cross_Bitmap(), '', '')
wx.EVT_TOOL(self, 3, self.OnC)
tb.ToggleTool(1, True)
tb.Realize()
def OnA(self, event=None):
print 'button a'
def OnB(self, event=None):
print 'button b'
def OnC(self, event=None):
print 'button c'
class Bla(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
frame = AppFrame(wx.NULL, -1, 'Bla')
frame.Show(True)
return True
if __name__ == '__main__':
app = Bla(0)
app.MainLoop()
Christian Kristukat wrote:
Robin Dunn wrote:
I encountered some strange behaviour of a couple of RadioTools ina wxToolBar. The EVT_TOOL events are sent only every second time if you keep clicking on the same tool. However if you just clicked one tool without having recieved the event and then click on another both events are sent simultaneous. Is this a known bug or a feature?
It is a bug, but not the one you implied. There should be no additional events for the consecutive clicks of the same radio tool, it should only generate an event when the state changes. Please enter a bug report about this, with a category of "wxGTK specific"
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Robin Dunn wrote:
Christian Kristukat wrote:
Robin Dunn wrote:
I encountered some strange behaviour of a couple of RadioTools ina wxToolBar. The EVT_TOOL events are sent only every second time if you keep clicking on the same tool. However if you just clicked one tool without having recieved the event and then click on another both events are sent simultaneous. Is this a known bug or a feature?
It is a bug, but not the one you implied. There should be no additional
Could you think of a workaround?
Chrisian
Christian Kristukat wrote:
Robin Dunn wrote:
Christian Kristukat wrote:
Robin Dunn wrote:
I encountered some strange behaviour of a couple of RadioTools ina wxToolBar. The EVT_TOOL events are sent only every second time if you keep clicking on the same tool. However if you just clicked one tool without having recieved the event and then click on another both events are sent simultaneous. Is this a known bug or a feature?
It is a bug, but not the one you implied. There should be no additional
Could you think of a workaround?
Only to track the toggle state of the radio tools yourself, and only respond to the events if the button was not down before.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!