Add space to sizer

Hi,

newbie to wxPython. Trying things out. Is there a way to add
resize-able space without using a control, which is the only way I've
managed to do it.

below is what I've done.
cheers,
Jonathan

···

--------------------------------------------------------------------------
class MyPanel(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id, style=wx.RAISED_BORDER)
        self.box=wx.BoxSizer(wx.HORIZONTAL)
        self.box.Add(wx.StaticText(self, -1, label = " "), 1,
wx.EXPAND)
        self.box.Add(wx.Button(self, -1, 'Button One'), 0)
        self.box.Add(wx.StaticText(self, -1, label = " "), 1,
wx.EXPAND)
        self.box.Add(wx.Button(self, -1, 'Button Two'), 0, wx.EXPAND)
        self.box.Add(wx.StaticText(self, -1, label = " "), 1,
wx.EXPAND)
        self.SetSizer(self.box)
        self.box.SetSizeHints(self)

class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, -1, title)
        self.box=wx.BoxSizer(wx.VERTICAL)
        self.box.Add(wx.StaticText(self, -1, label = " "), 1,
wx.EXPAND)
        self.box.Add(MyPanel(self, -1), 0, wx.EXPAND)
        self.SetAutoLayout(True)
        self.SetSizerAndFit(self.box)
        #self.box.SetSizeHints(self)

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, title="Sizer Test")
        self.SetTopWindow(frame)
        frame.Show(True)
        return True

if __name__ == '__main__':
    app = MyApp(0)
    app.MainLoop()

In Sunday, May 23, 2004, 9:28:22 PM, Jonathan wrote:

Hi,

newbie to wxPython. Trying things out. Is there a way to add
resize-able space without using a control, which is the only way I've
managed to do it.

below is what I've done.
(...)
self.box.Add(wx.StaticText(self, -1, label = " "), 1, wx.EXPAND)
(...)

Try this instead:

    self.box.Add(10, 10, 1, wx.EXPAND)

-- tacao

in wxpython 2.5.x space is added as a tuple:
self.box.Add((width, height), 1, wx.EXPAND)
in wxpython 2.4.* is added like:
self.box.Add(width, height, 1, wx.EXPAND)

···

On Mon, 24 May 2004 10:28:22 +1000, Jonathan Kelly <jonkelly@inspired.net.au> wrote:

Hi,

newbie to wxPython. Trying things out. Is there a way to add
resize-able space without using a control, which is the only way I've
managed to do it.

--
Peter Damoc
Hacker Wannabe

newbie to wxPython. Trying things out. Is there a way to add
resize-able space without using a control, which is the only way I've
managed to do it.

below is what I've done.
(...)
self.box.Add(wx.StaticText(self, -1, label = " "), 1, wx.EXPAND)
(...)

Try this instead:

   self.box.Add(10, 10, 1, wx.EXPAND)

That seems to be broken in 2.5.1.5...

Peter Damoc wrote:

···

On Mon, 24 May 2004 10:28:22 +1000, Jonathan Kelly > <jonkelly@inspired.net.au> wrote:

Hi,

newbie to wxPython. Trying things out. Is there a way to add
resize-able space without using a control, which is the only way I've
managed to do it.

in wxpython 2.5.x space is added as a tuple:
self.box.Add((width, height), 1, wx.EXPAND)
in wxpython 2.4.* is added like:
self.box.Add(width, height, 1, wx.EXPAND)

The first form also works in 2.4.1 and 2.4.2.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi
I have nested loops of about 5000 items each.
When I try to run them the app hangs after about 200 iterations of the
outer loop. It seems to hang at a slightly different point each time.
Any suggestions would be appreciated.
Thanks in advance
Greg

well... looks like a "run out of memory" thingy...
more items in the hypothesis are wellcome like:
OS version
wxpython wersion
what the heck do you have in those for loops "items" is too generic
if you have a widget instantiation in the inner loop... well... 5000 times 200 is like 1.000.000 widgets so the problem will look too much like "why the heck can't I install this winXP on my cousin's 286"

some code sample would be nice....

Altho some might be mindreaders a lot of us aren't.

···

On Sun, 30 May 2004 22:23:59 +1000, Greg Binns <gregbin@bigpond.net.au> wrote:

Hi
I have nested loops of about 5000 items each.
When I try to run them the app hangs after about 200 iterations of the
outer loop. It seems to hang at a slightly different point each time.
Any suggestions would be appreciated.
Thanks in advance
Greg

--
Peter Damoc
Hacker Wannabe