From: Andy T. <an...@ha...> - 2005-08-25 12:53:57
|
Alex Tweedly wrote: > bra...@om... wrote: > >> >> Any help on this would be greatly appreciated! I think it's a bug but >> I don't know >> if its in wxPython or in PythonCard. I guess my next step is to try to >> do something >> similar in wxPython. However, due to time constraints, I'm willing to put >> out a bounty on fixing this bug, $50 if it's fixed by Monday May 22! >> I can send via Paypal or check. >> > Here's a simple (perhaps too simple) wxPython prog that shows it works > OK on Win2000 and XP. > Give it a try on the mac and if it fails there, you can send to wxPython > list ... > > Good luck > btw - I'm travelling for next day or two so may not be on email for a > couple of days ....) > > > import wx > > #---------------------------------------------------------------------- > > class TestPanel(wx.Panel): > def __init__(self, parent, log): > wx.Panel.__init__(self, parent, -1) > self.log = log > self.count = 0 > > self.lb = wx.StaticBox(self, -1, "This example uses the > wx.StaticBox.", (45, 100), (200,400)) > self.btn = wx.Button(self, -1, "Test", (50,120)) > wx.EVT_LEFT_DOWN(self.lb, self.on_box) > wx.EVT_LEFT_DOWN(self.btn, self.on_btn) > > > def on_box(self, event): > print "box" > def on_btn(self, event): > print "btn" > #---------------------------------------------------------------------- > > if __name__ == '__main__': > import sys > app = wx.PySimpleApp() > frame = wx.Frame(None, -1, "title") > TestPanel(frame, sys.stdout) > frame.Show(True) > app.MainLoop() > > -- > Alex Tweedly http://www.tweedly.net > > Better late than never. I see the same problem with PythonCard from CVS, wxPython 2.5.3.1 and Python 2.3 on my iBook. I think the problem lies in the order that the widgets are created. Your sample wx appliation works as expected. The on_btn method is executed if you click on the Button widget. But if I swap the lines that create 'lb' and 'btn' in your example then the on_box method is executed when the mouse clicks anywhere inside the StaticBox and the on_btn method isn't. So by observation I conclude that the static box in Brad's application is being created after the widgets within it. Does anyone fancy delving into model.py to see if this could be the cause of the problem? Although I'm a little perturbed as to why this should be differ between the Mac and other platforms. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ |