StaticBoxSizer problems
Steve Holden
steve at holdenweb.com
Fri Mar 10 14:25:03 EST 2006
Matthias Kluwe wrote:
> Hi!
>
> Steve Holden wrote:
>
>>Did you actually try removing the line and running the program?
>
>
> I tried, of course :-) Removing the line
>
> box.Add(item=upper_box, flag=wx.GROW)
>
> yields the remaining program
>
> import wx
>
> app = wx.PySimpleApp()
> frame = wx.Frame(parent=None, title="Test")
> box = wx.BoxSizer(wx.VERTICAL)
> frame.SetSizer(box)
> upper_box = wx.StaticBox(parent=frame, label="Upper Box")
> upper_sizer = wx.StaticBoxSizer(upper_box)
> upper_sizer.Add(wx.Button(parent=frame, label="Button"))
> frame.Show()
> app.MainLoop()
>
>
>>>Hmm. As I see it, this means constructing the StaticBox and not placing
>>>it in the frame. Obviously, this does not help.
>
>
>>Guess what: the button appears inside the static box sizer. And your problem
>>with that would be ... ?
>
>
> ... the StaticBox not being displayed.
>
But the StaticBox *is* displayed when I run the program under Windows,
at least. What platform are you running on?
>
>>>"a methodical approach to GUI construction"? Please be more specific --
>>>any hints are welcome. Clearly, the above is an experiment with
>>>wxPython, not anything methodical. This may follow when I understand
>>>how StaticBoxSizer works.
>
>
>>Well, "methodical" would seem to include testing the suggestions of
>>well-meaning fellow netizens, for a start, rather than using your
>>psychic powers to predict results.
>
>
> No prediction needed :-) I can't see how I have suggested you're not
> well-meaning.
>
I didn't take any such inference from your response. I am slightly
confused that the program doesn't run for you, however. Here's the exact
source I ran:
import wx
app = wx.PySimpleApp()
frame = wx.Frame(parent=None, title="Test")
box = wx.BoxSizer(wx.VERTICAL)
frame.SetSizer(box)
upper_box = wx.StaticBox(parent=frame, label="Upper Box")
#box.Add(item=upper_box, flag=wx.GROW)
upper_sizer = wx.StaticBoxSizer(upper_box)
upper_sizer.Add(wx.Button(parent=frame, label="Button"))
box.Add(upper_sizer, flag=wx.GROW)
frame.Show()
print "running"
app.MainLoop()
The upper_box is displayed because it's presented as an argument to the
StaticBoxSizer's creator.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com
More information about the Python-list
mailing list