]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/og.py
   1 from wxPython
.wx 
import * 
   2 #from Lib.Gui.PlainWidgets import * 
   4 class TestLayoutConstraints(wxPanel
): 
   5     def __init__(self
, parent
): 
   6         wxPanel
.__init
__(self
, parent
, -1) 
   8         nb 
= wxNotebook(self
, -1) 
  10         page
.SetBackgroundColour(wxBLUE
) 
  11         button 
= wxButton(page
, -1, 'press me') 
  13         nb
.AddPage(page
, 'testpage') 
  15         lc 
= wxLayoutConstraints() 
  16         lc
.top
.PercentOf(parent
, wxBottom
, 0) 
  17         lc
.bottom
.PercentOf(parent
, wxBottom
, 100) 
  18         lc
.left
.PercentOf(parent
, wxRight
, 0) 
  19         lc
.right
.PercentOf(parent
, wxRight
, 100) 
  20         self
.SetConstraints(lc
) 
  21         self
.SetAutoLayout(true
) 
  23         lc 
= wxLayoutConstraints() 
  24         lc
.top
.PercentOf(self
, wxBottom
, 0) 
  25         lc
.bottom
.PercentOf(self
, wxBottom
, 100) 
  26         lc
.left
.PercentOf(self
, wxRight
, 0) 
  27         lc
.right
.PercentOf(self
, wxRight
, 100) 
  29 #        nb.SetAutoLayout(true) 
  31 #        lc = wxLayoutConstraints() 
  32 #        lc.top.PercentOf(nb, wxBottom, 0) 
  33 #        lc.bottom.PercentOf(nb, wxBottom, 100) 
  34 #        lc.left.PercentOf(nb, wxRight, 0) 
  35 #        lc.right.PercentOf(nb, wxRight, 100) 
  36 #        page.SetConstraints(lc) 
  37         page
.SetAutoLayout(true
) 
  39         # this should center "button" on "page": 
  40         lc 
= wxLayoutConstraints() 
  41         lc
.centreY
.PercentOf(page
, wxBottom
, 50) 
  42         lc
.centreX
.PercentOf(page
, wxRight
, 50) 
  45         button
.SetConstraints(lc
) 
  46 #        button.SetAutoLayout(true) 
  54 if __name__ 
== "__main__": 
  55     class MyFrame(wxFrame
): 
  56         def __init__(self
, *argT
, **optionD
): 
  57             apply(wxFrame
.__init
__, (self
,) + argT
, optionD
) 
  58             self
.SetAutoLayout(true
) 
  59             TestLayoutConstraints(self
) 
  63             frame 
= MyFrame(None, -1, "TestLayoutConstraints",