I'm just tarting with wxPythjon. I wrote this simple program to get some experience with panels.. It wants to open a frame and add a number of euivalent panels, each with an inactive button. And it does seem to do tht (the sizing is fixed because it's only a toy). The problem I see [working within PythonWin, inside Parallels on a Mac) is that if I instantiate the frame with more than one panel, the X button doen't close the frame and, if I click anyplace withing the frame, the frame and the PythonWin app both close. Help appreciated
<CODE>
#!/usr/bin/env python
import wx
""" Create many panels with a button
However, with more than one panel the frams doesn't close properly"""
class FrameWithButton(wx.Frame):
def __init__(self, number_of_panels=1):
wx.Frame.__init__(self,None,-1,"Frame subclass",size=(500,500))
self.panels=[]
for i in range(0, number_of_panels):
self.panels.append(wx.Panel(self, -1,size=(90,90),pos=(90*i,90*i)))
self.buttons=[]
for i in range(0, number_of_panels):
self.buttons.append( wx.Button(self.panels,-1,"Ignore me"))
class App(wx.App):
def OnInit(self):
self.frame = FrameWithButton(2) #Here's where the frame gets instantiaded
self.frame.Show()
self.SetTopWindow(self.frame)
return True
if "__main__" == __name__:
app = App()
app.MainLoop()
</CODE>

Sorry. Never mind as Gilda Radner used to say. Turns out to be an artifact in PythonWin. Doesn't happen when I run from command line or from SciPE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.