[Q] wxPython - layout & placement

Steve Menard steve.menard at polyester.com
Fri Jul 19 19:32:54 EDT 2002


"Rolf Marvin Bøe Lindgren" <roffe at aqualene.uio.no> wrote in message
news:lbzznwnpu98.fsf at aqualene.uio.no...
> I'm trying to place a button in a dialog window.  this works:
>
>         dlg = wxDialog(parent,-1,FileName,size=(400,400))
>
>         wxButton (parent=dlg,
>                   id = -1,
>                   label = 'This is a button',
>                   pos=(10,10))
>
>         dlg.ShowModal()
>
> but I'd like to use layout controls.  I've figured out how to do it
> with wxPanel, but wxDialog doesn't seem to work the same way.  the
> example on <URL:http://www.wxpython.org/tut-part2.php>
>
>         b = wxButton(self.panelA, 100, ' Panel A ')
>         lc = wxLayoutConstraints()
>         lc.centreX.SameAs (self.panelA, wxCentreX)
>         lc.centreY.SameAs (self.panelA, wxCentreY)
>         lc.height.AsIs ()
>         lc.width.PercentOf (self.panelA, wxWidth, 50)
>         b.SetConstraints(lc)
>
> does not work if the parent object is a wxDialog.
>
> any clues?
>
>
> --
> Rolf Lindgren
http://www.roffe.com/
> roffe at tag.uio.no

One easy solution is to us a wxPanel to do you layout, then put that panel
in the wxDialog. It should not be too hard to make sure the wxPanel fill out
the entire dialog ...


Steve
steve.menard at videotron.ca





More information about the Python-list mailing list