Thanks for the reply!
But I don't think it worked. I put the self.SetAutoLayout(true) call in the
wxFrame.__init__ and I still get the same problems: Buttons in the same
place, and memory leaks reported in the console.
Any other ideas?
Thanks again.
~Israel~
路路路
-----Original Message-----
From: bryan cole [mailto:bryan.cole@teraview.co.uk]
Sent: 25 February 2002 1:50 AM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] (Newbie) Leaking memory/Trouble with BoxSizers
I think you need a "self.SetAutoLayout(true)" call in your
wxFrame.__init__.
Bryan
On Sun, 2002-02-24 at 18:54, Israel wrote:
Hello there WXPython People!
I'm rather new to wxPython and I'm having a little trouble a couple of
things right now. I'm hoping that you can help me see the most likely
very obvious things that I'm missing.I'm attempting to understand the wxBoxSizer right now and I'm pretty
much failing. I have two buttons defined but they lay directly on top
of each other. I've also got memory leaks to Boot!I'm pasting my very short little test app to help clarify my blunders.
###---------------------------
from wxPython.wx import *class MyFrame(wxFrame):
def __init__(self, parent, title):
wxFrame.__init__(self, parent, -1, title, size=(350, 200))menuBar = wxMenuBar()
menu = wxMenu()
menu.Append(101, "E&xit\tAlt-X", "Exit demo")
EVT_MENU(self, 101, self.OnExit)
menuBar.Append(menu, "&File")
self.SetMenuBar(menuBar)#Adding a Sizer...
box = wxBoxSizer(wxHORIZONTAL)
#Making a button
button1 = wxButton(self, 102, "my button")
#Registering an event
EVT_BUTTON(self, 102, self.OnExit)
#making another button
button2 = wxButton(self, 103, "my other button")
#yet another event.
EVT_BUTTON(self, 103, self.OnExit)
#adding the first button.
box.Add(button1, 1, wxEXPAND)
#adding the second.
box.Add(button2, 0, wxEXPAND)self.CreateStatusBar() # empty status bar.
def OnExit(self, event):
self.Close()class App(wxApp):
def OnInit(self):
frame = MyFrame(NULL,"Leak Leak Leak!")
frame.Show(true)
self.SetTopWindow(frame)
return trueapp = App(0)
app.MainLoop()
###--------------------------------------I'm pretty sure that I'm doing the Sizer Wrong somehow, because if I
delete the buttons and leave the sizer, I get memory leaks. Everything
seems to work, I just get trash talk from the console. If I delete the
sizer and the buttons, then I everything is functional yet the app feels
a bit sparse.Now the Buttons also lie in the same space, I tried specifying their
positions, but that didn't seem to help the way I was doing it.Can ya help a poor programatically challenged artist out with the
complexities of understanding this cool GUI system?Thanks,
~Israel~
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
--
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge
CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users