Hi all,
I'm having a problem with wxPopupTransientWindow closing prematurely. In the
example I've provided below clicking on the open button opens a
wxPopupTransientWindow with 3 buttons in it. If I try to click buttons B or
C then the wxPopupTransientWindow disappears without the EVT_BUTTON handler
being run. If I click on button A first (The one with the focus, don't know
if that's relevant) then the handler runs and I can then click on any of the
buttons as often as I like without the window closing.
I'm running wxPython 24.24u on Python 2.3.2 on WinXP
Any thoughts? Should I submit this as a bug?
Cheers,
Rich
-- Code Starts --
import wx
class MyPanel(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
moreButton = wx.Button(self,-1,"Open", size = (120,20))
wx.EVT_BUTTON(self,moreButton.GetId(),self.OnOpen)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(moreButton,1,wx.EXPAND)
self.SetSizerAndFit(sizer)
def OnOpen(self, event):
otherPanel = wx.PopupTransientWindow(self,wx.RAISED_BORDER)
otherPanel.SetSize(self.GetSize())
btn = event.GetEventObject()
sz = btn.GetSize()
otherPanel.Position(self.ClientToScreen((0,0)),(0, sz.height))
buttonA = wx.Button(otherPanel,-1,"A")
buttonB = wx.Button(otherPanel,-1,"B")
buttonC = wx.Button(otherPanel,-1,"C")
wx.EVT_BUTTON(self,buttonA.GetId(),self.OnButton)
wx.EVT_BUTTON(self,buttonB.GetId(),self.OnButton)
wx.EVT_BUTTON(self,buttonC.GetId(),self.OnButton)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(buttonA,1,wx.EXPAND)
sizer.Add(buttonB,1,wx.EXPAND)
sizer.Add(buttonC,1,wx.EXPAND)
otherPanel.SetSizer(sizer)
otherPanel.Layout()
otherPanel.Popup()
def OnButton(self, event):
print event.GetEventObject().GetLabel()
def test():
app = wx.PySimpleApp()
frame = wx.Frame(None,-1,"PopupTransientWindow Bug")
basket = MyPanel(frame,-1)
frame.Fit()
frame.Show(True)
app.MainLoop()
if __name__ == "__main__":
test()
------- Important Disclaimer follows -------
The information in this email and any attachments is confidential and is
solely for the attention of the addressee. It must not be disclosed to any
third party without our prior authority. Any figures or financial data are
for informational purposes only and are not intended as an offer for
purchase or sale of any security. If you are not the intended recipient,
please telephone +44 (20) 7594 4000 immediately.