Compare commits
1 Commits
wxPy_2_5_1
...
wxPy_2_5_1
Author | SHA1 | Date | |
---|---|---|---|
|
9e22785455 |
@@ -38,7 +38,7 @@ import distutils.command.clean
|
||||
VER_MAJOR = 2 # The first three must match wxWidgets
|
||||
VER_MINOR = 5
|
||||
VER_RELEASE = 1
|
||||
VER_SUBREL = 4 # wxPython release num for x.y.z release of wxWidgets
|
||||
VER_SUBREL = 5 # wxPython release num for x.y.z release of wxWidgets
|
||||
VER_FLAGS = "" # release flags, such as prerelease num, unicode, etc.
|
||||
|
||||
DESCRIPTION = "Cross platform GUI toolkit for Python"
|
||||
|
@@ -195,7 +195,10 @@ class MimeTypesDemoPanel(wx.Panel):
|
||||
tsizer.Fit(self)
|
||||
|
||||
# Populate the Known MIME types list with what is in the database
|
||||
mtypes = wx.TheMimeTypesManager.EnumAllFileTypes()
|
||||
try:
|
||||
mtypes = wx.TheMimeTypesManager.EnumAllFileTypes()
|
||||
except wx.PyAssertionError:
|
||||
mtypes = []
|
||||
for mt in mtypes:
|
||||
self.mimelist.Append(mt)
|
||||
|
||||
|
@@ -13,14 +13,58 @@
|
||||
|
||||
import wx
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class SampleWindow(wx.PyWindow):
|
||||
"""
|
||||
A simple window that is used as sizer items in the tests below to
|
||||
show how the various sizers work.
|
||||
"""
|
||||
def __init__(self, parent, text, pos=wx.DefaultPosition, size=wx.DefaultSize):
|
||||
wx.PyWindow.__init__(self, parent, -1,
|
||||
#style=wx.RAISED_BORDER
|
||||
#style=wx.SUNKEN_BORDER
|
||||
style=wx.SIMPLE_BORDER
|
||||
)
|
||||
self.text = text
|
||||
if size != wx.DefaultSize:
|
||||
self.bestsize = size
|
||||
else:
|
||||
self.bestsize = (80,25)
|
||||
self.SetSize(self.GetBestSize())
|
||||
|
||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||
self.Bind(wx.EVT_SIZE, self.OnSize)
|
||||
self.Bind(wx.EVT_LEFT_UP, self.OnCloseParent)
|
||||
|
||||
|
||||
def OnPaint(self, evt):
|
||||
sz = self.GetSize()
|
||||
dc = wx.PaintDC(self)
|
||||
w,h = dc.GetTextExtent(self.text)
|
||||
dc.Clear()
|
||||
dc.DrawText(self.text, ((sz.width-w)/2, (sz.height-h)/2))
|
||||
|
||||
def OnSize(self, evt):
|
||||
self.Refresh()
|
||||
|
||||
def OnCloseParent(self, evt):
|
||||
p = wx.GetTopLevelParent(self)
|
||||
if p:
|
||||
p.Close()
|
||||
|
||||
def DoGetBestSize(self):
|
||||
return self.bestsize
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def makeSimpleBox1(win):
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -28,10 +72,10 @@ def makeSimpleBox1(win):
|
||||
|
||||
def makeSimpleBox2(win):
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -39,11 +83,11 @@ def makeSimpleBox2(win):
|
||||
|
||||
def makeSimpleBox3(win):
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -51,11 +95,11 @@ def makeSimpleBox3(win):
|
||||
|
||||
def makeSimpleBox4(win):
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "three"), 1, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "four"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -63,11 +107,11 @@ def makeSimpleBox4(win):
|
||||
|
||||
def makeSimpleBox5(win):
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "three"), 3, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "five"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 3, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "four"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -75,11 +119,11 @@ def makeSimpleBox5(win):
|
||||
|
||||
def makeSimpleBox6(win):
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(wx.Button(win, -1, "one"), 1, wx.ALIGN_TOP)
|
||||
box.Add(wx.Button(win, -1, "two"), 1, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "three"), 1, wx.ALIGN_CENTER)
|
||||
box.Add(wx.Button(win, -1, "four"), 1, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "five"), 1, wx.ALIGN_BOTTOM)
|
||||
box.Add(SampleWindow(win, "one"), 1, wx.ALIGN_TOP)
|
||||
box.Add(SampleWindow(win, "two"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 1, wx.ALIGN_CENTER)
|
||||
box.Add(SampleWindow(win, "four"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "five"), 1, wx.ALIGN_BOTTOM)
|
||||
|
||||
return box
|
||||
|
||||
@@ -87,11 +131,11 @@ def makeSimpleBox6(win):
|
||||
|
||||
def makeSimpleBox7(win):
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(wx.Button(win, 1010, "one"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, 1010, "two"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, 1010, "three"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
|
||||
box.Add((60, 20), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, 1010, "five"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -99,13 +143,13 @@ def makeSimpleBox7(win):
|
||||
|
||||
def makeSimpleBox8(win):
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
box.Add(wx.Button(win, 1010, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
box.Add((0,0), 1)
|
||||
box.Add(wx.Button(win, 1010, "two"), 0, wx.ALIGN_CENTER)
|
||||
box.Add(SampleWindow(win, "two"), 0, wx.ALIGN_CENTER)
|
||||
box.Add((0,0), 1)
|
||||
box.Add(wx.Button(win, 1010, "three"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, 1010, "four"), 0, wx.EXPAND)
|
||||
# box.Add(wx.Button(win, 1010, "five"), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
|
||||
# box.Add(SampleWindow(win, "five"), 1, wx.EXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -114,7 +158,7 @@ def makeSimpleBox8(win):
|
||||
|
||||
def makeSimpleBorder1(win):
|
||||
bdr = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btn = wx.Button(win, -1, "border")
|
||||
btn = SampleWindow(win, "border")
|
||||
btn.SetSize((80, 80))
|
||||
bdr.Add(btn, 1, wx.EXPAND|wx.ALL, 15)
|
||||
|
||||
@@ -124,7 +168,7 @@ def makeSimpleBorder1(win):
|
||||
|
||||
def makeSimpleBorder2(win):
|
||||
bdr = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btn = wx.Button(win, -1, "border")
|
||||
btn = SampleWindow(win, "border")
|
||||
btn.SetSize((80, 80))
|
||||
bdr.Add(btn, 1, wx.EXPAND | wx.EAST | wx.WEST, 15)
|
||||
|
||||
@@ -134,7 +178,7 @@ def makeSimpleBorder2(win):
|
||||
|
||||
def makeSimpleBorder3(win):
|
||||
bdr = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btn = wx.Button(win, -1, "border")
|
||||
btn = SampleWindow(win, "border")
|
||||
btn.SetSize((80, 80))
|
||||
bdr.Add(btn, 1, wx.EXPAND | wx.NORTH | wx.WEST, 15)
|
||||
|
||||
@@ -146,26 +190,26 @@ def makeSimpleBorder3(win):
|
||||
def makeBoxInBox(win):
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
|
||||
box2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box2.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
|
||||
btn3 = wx.Button(win, -1, "three")
|
||||
box2.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
|
||||
btn3 = SampleWindow(win, "three")
|
||||
box2.Add(btn3, 0, wx.EXPAND)
|
||||
box2.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
|
||||
box2.Add(wx.Button(win, -1, "five"), 0, wx.EXPAND)
|
||||
box2.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
|
||||
box2.Add(SampleWindow(win, "five"), 0, wx.EXPAND)
|
||||
|
||||
box3 = wx.BoxSizer(wx.VERTICAL)
|
||||
box3.AddMany([ (wx.Button(win, -1, "six"), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, "seven"), 2, wx.EXPAND),
|
||||
(wx.Button(win, -1, "eight"), 1, wx.EXPAND),
|
||||
(wx.Button(win, -1, "nine"), 1, wx.EXPAND),
|
||||
box3.AddMany([ (SampleWindow(win, "six"), 0, wx.EXPAND),
|
||||
(SampleWindow(win, "seven"), 2, wx.EXPAND),
|
||||
(SampleWindow(win, "eight"), 1, wx.EXPAND),
|
||||
(SampleWindow(win, "nine"), 1, wx.EXPAND),
|
||||
])
|
||||
|
||||
box2.Add(box3, 1, wx.EXPAND)
|
||||
box.Add(box2, 1, wx.EXPAND)
|
||||
|
||||
box.Add(wx.Button(win, -1, "ten"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "ten"), 0, wx.EXPAND)
|
||||
|
||||
##box.Hide(btn3)
|
||||
|
||||
@@ -186,31 +230,31 @@ def makeBorderInBox(win):
|
||||
insideBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
box2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box2.AddMany([ (wx.Button(win, -1, "one"), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, "two"), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, "three"), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, "four"), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, "five"), 0, wx.EXPAND),
|
||||
box2.AddMany([ (SampleWindow(win, "one"), 0, wx.EXPAND),
|
||||
(SampleWindow(win, "two"), 0, wx.EXPAND),
|
||||
(SampleWindow(win, "three"), 0, wx.EXPAND),
|
||||
(SampleWindow(win, "four"), 0, wx.EXPAND),
|
||||
(SampleWindow(win, "five"), 0, wx.EXPAND),
|
||||
])
|
||||
|
||||
insideBox.Add(box2, 0, wx.EXPAND)
|
||||
|
||||
bdr = wx.BoxSizer(wx.HORIZONTAL)
|
||||
bdr.Add(wx.Button(win, -1, "border"), 1, wx.EXPAND | wx.ALL)
|
||||
bdr.Add(SampleWindow(win, "border"), 1, wx.EXPAND | wx.ALL)
|
||||
insideBox.Add(bdr, 1, wx.EXPAND | wx.ALL, 20)
|
||||
|
||||
box3 = wx.BoxSizer(wx.VERTICAL)
|
||||
box3.AddMany([ (wx.Button(win, -1, "six"), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, "seven"), 2, wx.EXPAND),
|
||||
(wx.Button(win, -1, "eight"), 1, wx.EXPAND),
|
||||
(wx.Button(win, -1, "nine"), 1, wx.EXPAND),
|
||||
box3.AddMany([ (SampleWindow(win, "six"), 0, wx.EXPAND),
|
||||
(SampleWindow(win, "seven"), 2, wx.EXPAND),
|
||||
(SampleWindow(win, "eight"), 1, wx.EXPAND),
|
||||
(SampleWindow(win, "nine"), 1, wx.EXPAND),
|
||||
])
|
||||
insideBox.Add(box3, 1, wx.EXPAND)
|
||||
|
||||
outsideBox = wx.BoxSizer(wx.VERTICAL)
|
||||
outsideBox.Add(wx.Button(win, -1, "top"), 0, wx.EXPAND)
|
||||
outsideBox.Add(SampleWindow(win, "top"), 0, wx.EXPAND)
|
||||
outsideBox.Add(insideBox, 1, wx.EXPAND)
|
||||
outsideBox.Add(wx.Button(win, -1, "bottom"), 0, wx.EXPAND)
|
||||
outsideBox.Add(SampleWindow(win, "bottom"), 0, wx.EXPAND)
|
||||
|
||||
return outsideBox
|
||||
|
||||
@@ -220,16 +264,16 @@ def makeBorderInBox(win):
|
||||
def makeGrid1(win):
|
||||
gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
|
||||
|
||||
gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'two'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'three'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'four'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'five'), 0, wx.EXPAND),
|
||||
gs.AddMany([ (SampleWindow(win, 'one'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'two'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'three'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'four'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'five'), 0, wx.EXPAND),
|
||||
#(75, 50),
|
||||
(wx.Button(win, -1, 'six'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'seven'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'nine'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'six'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'seven'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'eight'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'nine'), 0, wx.EXPAND),
|
||||
])
|
||||
|
||||
return gs
|
||||
@@ -240,23 +284,23 @@ def makeGrid2(win):
|
||||
gs = wx.GridSizer(3, 3) # rows, cols, hgap, vgap
|
||||
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
box.Add(wx.Button(win, -1, 'A'), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, 'B'), 1, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, 'A'), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, 'B'), 1, wx.EXPAND)
|
||||
|
||||
gs2 = wx.GridSizer(2,2, 4, 4)
|
||||
gs2.AddMany([ (wx.Button(win, -1, 'C'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'E'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'F'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'G'), 0, wx.EXPAND)])
|
||||
gs2.AddMany([ (SampleWindow(win, 'C'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'E'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'F'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'G'), 0, wx.EXPAND)])
|
||||
|
||||
gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM),
|
||||
(wx.Button(win, -1, 'two'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'three'), 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM),
|
||||
(wx.Button(win, -1, 'four'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'five'), 0, wx.ALIGN_CENTER),
|
||||
(wx.Button(win, -1, 'six'), 0, wx.EXPAND),
|
||||
gs.AddMany([ (SampleWindow(win, 'one'), 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM),
|
||||
(SampleWindow(win, 'two'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'three'), 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM),
|
||||
(SampleWindow(win, 'four'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'five'), 0, wx.ALIGN_CENTER),
|
||||
(SampleWindow(win, 'six'), 0, wx.EXPAND),
|
||||
(box, 0, wx.EXPAND | wx.ALL, 10),
|
||||
(wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'eight'), 0, wx.EXPAND),
|
||||
(gs2, 0, wx.EXPAND | wx.ALL, 4),
|
||||
])
|
||||
|
||||
@@ -267,16 +311,16 @@ def makeGrid2(win):
|
||||
def makeGrid3(win):
|
||||
gs = wx.FlexGridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
|
||||
|
||||
gs.AddMany([ (wx.Button(win, -1, 'one'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'two'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'three'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'four'), 0, wx.EXPAND),
|
||||
#(wx.Button(win, 1010, 'five'), 0, wx.EXPAND),
|
||||
gs.AddMany([ (SampleWindow(win, 'one'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'two'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'three'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'four'), 0, wx.EXPAND),
|
||||
#(SampleWindow(win, 'five'), 0, wx.EXPAND),
|
||||
((175, 50)),
|
||||
(wx.Button(win, -1, 'six'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'seven'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'eight'), 0, wx.EXPAND),
|
||||
(wx.Button(win, -1, 'nine'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'six'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'seven'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'eight'), 0, wx.EXPAND),
|
||||
(SampleWindow(win, 'nine'), 0, wx.EXPAND),
|
||||
])
|
||||
|
||||
gs.AddGrowableRow(0)
|
||||
@@ -291,23 +335,23 @@ def makeGrid4(win):
|
||||
bsize = wx.Size(100, 50)
|
||||
gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
|
||||
|
||||
gs.AddMany([ (wx.Button(win, -1, 'one', bpos, bsize),
|
||||
gs.AddMany([ (SampleWindow(win, 'one', bpos, bsize),
|
||||
0, wx.ALIGN_TOP | wx.ALIGN_LEFT ),
|
||||
(wx.Button(win, -1, 'two', bpos, bsize),
|
||||
(SampleWindow(win, 'two', bpos, bsize),
|
||||
0, wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL ),
|
||||
(wx.Button(win, -1, 'three', bpos, bsize),
|
||||
(SampleWindow(win, 'three', bpos, bsize),
|
||||
0, wx.ALIGN_TOP | wx.ALIGN_RIGHT ),
|
||||
(wx.Button(win, -1, 'four', bpos, bsize),
|
||||
(SampleWindow(win, 'four', bpos, bsize),
|
||||
0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT ),
|
||||
(wx.Button(win, -1, 'five', bpos, bsize),
|
||||
(SampleWindow(win, 'five', bpos, bsize),
|
||||
0, wx.ALIGN_CENTER ),
|
||||
(wx.Button(win, -1, 'six', bpos, bsize),
|
||||
(SampleWindow(win, 'six', bpos, bsize),
|
||||
0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT ),
|
||||
(wx.Button(win, -1, 'seven', bpos, bsize),
|
||||
(SampleWindow(win, 'seven', bpos, bsize),
|
||||
0, wx.ALIGN_BOTTOM | wx.ALIGN_LEFT ),
|
||||
(wx.Button(win, -1, 'eight', bpos, bsize),
|
||||
(SampleWindow(win, 'eight', bpos, bsize),
|
||||
0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL ),
|
||||
(wx.Button(win, -1, 'nine', bpos, bsize),
|
||||
(SampleWindow(win, 'nine', bpos, bsize),
|
||||
0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT ),
|
||||
])
|
||||
|
||||
@@ -320,23 +364,23 @@ def makeShapes(win):
|
||||
bsize = wx.Size(100, 50)
|
||||
gs = wx.GridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
|
||||
|
||||
gs.AddMany([ (wx.Button(win, -1, 'one', bpos, bsize),
|
||||
gs.AddMany([ (SampleWindow(win, 'one', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_LEFT ),
|
||||
(wx.Button(win, -1, 'two', bpos, bsize),
|
||||
(SampleWindow(win, 'two', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL ),
|
||||
(wx.Button(win, -1, 'three', bpos, bsize),
|
||||
(SampleWindow(win, 'three', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_TOP | wx.ALIGN_RIGHT ),
|
||||
(wx.Button(win, -1, 'four', bpos, bsize),
|
||||
(SampleWindow(win, 'four', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT ),
|
||||
(wx.Button(win, -1, 'five', bpos, bsize),
|
||||
(SampleWindow(win, 'five', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_CENTER ),
|
||||
(wx.Button(win, -1, 'six', bpos, bsize),
|
||||
(SampleWindow(win, 'six', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT ),
|
||||
(wx.Button(win, -1, 'seven', bpos, bsize),
|
||||
(SampleWindow(win, 'seven', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_LEFT ),
|
||||
(wx.Button(win, -1, 'eight', bpos, bsize),
|
||||
(SampleWindow(win, 'eight', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL ),
|
||||
(wx.Button(win, -1, 'nine', bpos, bsize),
|
||||
(SampleWindow(win, 'nine', bpos, bsize),
|
||||
0, wx.SHAPED | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT ),
|
||||
])
|
||||
|
||||
@@ -346,11 +390,11 @@ def makeShapes(win):
|
||||
|
||||
def makeSimpleBoxShaped(win):
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
box.Add(wx.Button(win, -1, "one"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "two"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "three"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "four"), 0, wx.EXPAND)
|
||||
box.Add(wx.Button(win, -1, "five"), 1, wx.SHAPED)
|
||||
box.Add(SampleWindow(win, "one"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "two"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "three"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "four"), 0, wx.EXPAND)
|
||||
box.Add(SampleWindow(win, "five"), 1, wx.SHAPED)
|
||||
|
||||
return box
|
||||
|
||||
@@ -482,7 +526,6 @@ theTests = [
|
||||
class TestFrame(wx.Frame):
|
||||
def __init__(self, parent, title, sizerFunc):
|
||||
wx.Frame.__init__(self, parent, -1, title)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnButton)
|
||||
|
||||
p = wx.Panel(self, -1)
|
||||
|
||||
@@ -491,7 +534,6 @@ class TestFrame(wx.Frame):
|
||||
self.SetStatusText("Resize this frame to see how the sizers respond...")
|
||||
self.sizer.Fit(p)
|
||||
|
||||
p.SetAutoLayout(True)
|
||||
p.SetSizer(self.sizer)
|
||||
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
|
||||
self.Fit()
|
||||
@@ -500,8 +542,6 @@ class TestFrame(wx.Frame):
|
||||
self.MakeModal(False)
|
||||
self.Destroy()
|
||||
|
||||
def OnButton(self, event):
|
||||
self.Close(True)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
@@ -38,17 +38,24 @@ class MyCustomPanel(wx.Panel):
|
||||
# silly example. It could just as easily have been done in
|
||||
# the resource. We do it in the EVT_WINDOW_CREATE handler
|
||||
# because the window doesn't really exist yet in the __init__.
|
||||
t = wx.StaticText(self, -1, "MyCustomPanel")
|
||||
f = t.GetFont()
|
||||
f.SetWeight(wx.BOLD)
|
||||
f.SetPointSize(f.GetPointSize()+2)
|
||||
t.SetFont(f)
|
||||
self.t = t
|
||||
if self is evt.GetEventObject():
|
||||
t = wx.StaticText(self, -1, "MyCustomPanel")
|
||||
f = t.GetFont()
|
||||
f.SetWeight(wx.BOLD)
|
||||
f.SetPointSize(f.GetPointSize()+2)
|
||||
t.SetFont(f)
|
||||
self.t = t
|
||||
# On OSX the EVT_SIZE happens before EVT_WINDOW_CREATE !?!
|
||||
# so give it another kick
|
||||
wx.CallAfter(self.OnSize, None)
|
||||
|
||||
|
||||
def OnSize(self, evt):
|
||||
sz = self.GetSize()
|
||||
w, h = self.t.GetTextExtent(self.t.GetLabel())
|
||||
self.t.SetPosition(((sz.width-w)/2, (sz.height-h)/2))
|
||||
if hasattr(self, 't'):
|
||||
sz = self.GetSize()
|
||||
w, h = self.t.GetTextExtent(self.t.GetLabel())
|
||||
print w, h
|
||||
self.t.SetPosition(((sz.width-w)/2, (sz.height-h)/2))
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -73,7 +80,9 @@ class TestPanel(wx.Panel):
|
||||
res.LoadFromString(resourceText)
|
||||
|
||||
# Now create a panel from the resource data
|
||||
panel = res.LoadPanel(self, "MyPanel")
|
||||
#panel = res.LoadPanel(self, "MyPanel")
|
||||
panel = MyCustomPanel()
|
||||
panel.Create(self, -1)
|
||||
|
||||
# and do the layout
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
@@ -20,11 +20,11 @@ importantly, that you know what you are doing! ;-)</p>
|
||||
<p>If you want to also install the version of wxPython you build to be in
|
||||
your site-packages dir and be your default version of wxPython, then a
|
||||
few additional steps are needed, and you may want to use slightly
|
||||
different options. See INSTALL.txt for more details. If you only use
|
||||
the instructions in this BUILD.txt file then you will end up with a
|
||||
separate installation of wxPython and you can switch back and forth
|
||||
between this and the release version that you may already have
|
||||
installed.</p>
|
||||
different options. See the <a class="reference" href="INSTALL.html">INSTALL</a> document for more details. If
|
||||
you only use the instructions in this <a class="reference" href="BUILD.html">BUILD</a> document file then you
|
||||
will end up with a separate installation of wxPython and you can
|
||||
switch back and forth between this and the release version that you
|
||||
may already have installed.</p>
|
||||
<p>If you want to make changes to any of the <tt class="literal"><span class="pre">*.i</span></tt> files, (SWIG interface
|
||||
definition files,) or to regenerate the extension sources or renamer
|
||||
modules, then you will need an up to date version of SWIG. Either get
|
||||
@@ -37,6 +37,13 @@ with an existing SWIG install for example) then you can set a setup.py
|
||||
command-line variable named SWIG to be the full path name of the
|
||||
executable and the wxPython build will use it. See below for an
|
||||
example.</p>
|
||||
<p>In the text below I'll use WXDIR with environment variable syntax
|
||||
(either $WXDIR or %WXDIR%) to refer to the top level directory were
|
||||
your wxWidgerts and wxPython sources are located. It will equate to
|
||||
whereever you checked out the wxWidgets module from CVS, or untarred
|
||||
the wxPythonSrc tarball to. You can either substitute the $WXDIR text
|
||||
below with your actual dir, or set the value in the environment and
|
||||
use it just like you see it below.</p>
|
||||
<div class="section" id="building-on-unix-like-systems-e-g-linux-and-os-x">
|
||||
<h1><a name="building-on-unix-like-systems-e-g-linux-and-os-x">Building on Unix-like Systems (e.g. Linux and OS X)</a></h1>
|
||||
<p>These platforms are built almost the same way while in development
|
||||
@@ -52,6 +59,7 @@ build dir so I can easily blow away everything in the build dir and
|
||||
rerun the script without having to remember the options I used
|
||||
before:</p>
|
||||
<pre class="literal-block">
|
||||
cd $WXDIR
|
||||
mkdir bld
|
||||
cd bld
|
||||
../configure --prefix=/opt/wx/2.5 \
|
||||
@@ -114,10 +122,11 @@ wxWidgets you just need to add /opt/wx/2.5/bin to the PATH and set
|
||||
LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH on OS X) to /opt/wx/2.5/lib.</p>
|
||||
</li>
|
||||
<li><p class="first">I also have a script to help me build wxPython and it is checked in
|
||||
to the CVS as wxWidgets/wxPython/b, but probably don't want to use
|
||||
it as it's very cryptic and expects that you want to run SWIG, so
|
||||
if you don't have the latest patched up version of SWIG then you'll
|
||||
probably get stuck. So I'll just give the raw commands instead.</p>
|
||||
to the CVS as wxWidgets/wxPython/b, but you probably don't want to
|
||||
use it as it's very cryptic and expects that you want to run SWIG,
|
||||
so if you don't have the latest patched up version of SWIG then
|
||||
you'll probably get stuck. So I'll just give the raw commands
|
||||
instead.</p>
|
||||
<p>We're not going to install the development version of wxPython with
|
||||
these commands, so it won't impact your already installed version
|
||||
of the latest release. You'll be able test with this version when
|
||||
@@ -129,10 +138,10 @@ sure to use the version of Python that you want to use when running
|
||||
wxPython programs to run the setup.py commands below. I'll be
|
||||
using python2.3.</p>
|
||||
<p>Make sure that the first wx-config found on the PATH is the one you
|
||||
installed above, and then change to the wxWidgets/wxPython dir and
|
||||
installed above, and then change to the $WXDIR/wxPython dir and
|
||||
run the this command:</p>
|
||||
<pre class="literal-block">
|
||||
cd wxPython
|
||||
cd $WXDIR/wxPython
|
||||
python2.3 setup.py build_ext --inplace --debug
|
||||
</pre>
|
||||
<p>If your new wx-config script is not on the PATH, or there is some
|
||||
@@ -157,23 +166,24 @@ or something like that then you can add BUILD_GLCANVAS=0 to the
|
||||
setup.py command line to disable the building of the glcanvas
|
||||
module.</p>
|
||||
<p>When the setup.py command is done you should have fully populated
|
||||
wxPython and wx packages locally in wxWidgets/wxPython/wxPython and
|
||||
.../wx, with all the extension modules (<tt class="literal"><span class="pre">*.so</span></tt> files) located in the
|
||||
wx package.</p>
|
||||
wxPython and wx packages locally in $WXDIR/wxPython/wxPython and
|
||||
$WXDIR/wxPython/wx, with all the extension modules (<tt class="literal"><span class="pre">*.so</span></tt> files)
|
||||
located in the wx package.</p>
|
||||
</li>
|
||||
<li><p class="first">To run code with the development verison of wxPython, just set the
|
||||
PYTHONPATH to the wxPython dir in the CVS tree. For example:</p>
|
||||
PYTHONPATH to the wxPython dir located in the source tree. For
|
||||
example:</p>
|
||||
<pre class="literal-block">
|
||||
export LD_LIBRARY=/opt/wx/2.5/lib
|
||||
export PYTHONPATH=/myprojects/wxWidgets/wxPython
|
||||
cd /myprojects/wxWidgets/wxPython/demo
|
||||
export LD_LIBRARY_PATH=/opt/wx/2.5/lib
|
||||
export PYTHONPATH=$WXDIR/wxPython
|
||||
cd $WXDIR/wxPython/demo
|
||||
python2.3 demo.py
|
||||
</pre>
|
||||
<p>OS X NOTE: You need to use "pythonw" on the command line to run
|
||||
wxPython applications. This version of the Python executable is
|
||||
part of the Python Framework and is allowed to interact with the
|
||||
display. You can also double click on a .py or a .pyw file from
|
||||
the finder (assuming that PythonLauncher is still associated with
|
||||
the finder (assuming that the PythonLauncher app is associated with
|
||||
these file extensions) and it will launch the Framework version of
|
||||
Python for you. For information about creating Applicaiton Bundles
|
||||
of your wxPython apps please see the wiki and the mail lists.</p>
|
||||
@@ -197,10 +207,11 @@ modules using that compiler, and then make a few changes to setup.py
|
||||
to accomodate that. (And send the patches to me.) If you plan on
|
||||
using VisualStudio.Net (a.k.a. MSVC 7.1) keep in mind that you'll also
|
||||
have to build Python and any other extension modules that you use with
|
||||
that compiler because a different version of the C runtime likbrary is
|
||||
that compiler because a different version of the C runtime library is
|
||||
used. The Python executable that comes from PythonLabs and the
|
||||
wxPython extensions that I distribute are built with MSVC 6 with all
|
||||
the Service Packs applied.</p>
|
||||
the Service Packs applied. This policy will change with Python 2.4
|
||||
and MSVC 7.1 will be used starting with that version.</p>
|
||||
<p>If you want to build a debugable version of wxWidgets and wxPython you
|
||||
will need to have also built a debug version of Python and any other
|
||||
extension modules you need to use. You can tell if you have them
|
||||
@@ -211,25 +222,28 @@ version is fine, and you can use the regular python executables with
|
||||
it.</p>
|
||||
<p>Just like the unix versions I also use some scripts to help me build
|
||||
wxWidgets, but I use some non-standard stuff to do it. So if you want
|
||||
to use them too you'll need to get a copy or 4DOS or 4NT from
|
||||
to use my scripts you'll need to get a copy or 4DOS or 4NT from
|
||||
<a class="reference" href="http://www.jpsoft.com/">http://www.jpsoft.com/</a> and also a copy of unix-like cat and sed
|
||||
programs. You can also do by hand what my scripts are doing, but
|
||||
there are a lof steps involved and I won't be going into details
|
||||
here. There is a copy of my build scripts in wxWidgetswxPythondistribmsw</p>
|
||||
there are alot of steps involved and I won't be going into details
|
||||
here. There is a copy of my build scripts in %WXDIR%wxPythondistribmsw
|
||||
that you can use for reference (if you don't use them directly) for
|
||||
adapting these instructions to your specific needs. The directions
|
||||
below assume that you are using my scripts.</p>
|
||||
<ol class="arabic">
|
||||
<li><p class="first">Set an environment variable to the root of the wxWidgets source
|
||||
tree:</p>
|
||||
tree. This is used by the makefiles:</p>
|
||||
<pre class="literal-block">
|
||||
set WXWIN=e:\projects\wxWidgets
|
||||
set WXWIN=%WXDIR%
|
||||
</pre>
|
||||
</li>
|
||||
<li><p class="first">Copy setup0.h to setup.h</p>
|
||||
<blockquote>
|
||||
<p>cd %WXWIN%includewxmsw
|
||||
<p>cd %WXDIR%includewxmsw
|
||||
copy setup0.h setup.h</p>
|
||||
</blockquote>
|
||||
</li>
|
||||
<li><p class="first">Edit %WXWIN%includewxmswsetup.h and change a few settings.
|
||||
<li><p class="first">Edit %WXDIR%includewxmswsetup.h and change a few settings.
|
||||
Some of them are changed by my build scripts depending on the type
|
||||
of build (debug/hybrid, unicode/ansi). I change a few of the other
|
||||
defaults to have these values:</p>
|
||||
@@ -244,12 +258,13 @@ wxUSE_AFM_FOR_POSTSCRIPT 0
|
||||
wxUSE_DISPLAY 1
|
||||
</pre>
|
||||
</li>
|
||||
<li><p class="first">Make sure that %WXWIN%libvc_dll directory is on the PATH. The
|
||||
<li><p class="first">Make sure that %WXDIR%libvc_dll directory is on the PATH. The
|
||||
wxWidgets DLLs will end up there as part of the build and so you'll
|
||||
need it on the PATH for them to be found at runtime.</p>
|
||||
</li>
|
||||
<li><p class="first">Change to the %WXWIN%buildmsw directory and copy my build scripts
|
||||
there.</p>
|
||||
<li><p class="first">Change to the %WXDIR%buildmsw directory and copy my build scripts
|
||||
there from their default location in %WXDIR%wxPythondistribmsw
|
||||
if they are not present already.</p>
|
||||
</li>
|
||||
<li><p class="first">Use the .make.btm command to build wxWidgets. It needs one
|
||||
command-line parameter which controls what kind of build(s) to do.
|
||||
@@ -285,11 +300,11 @@ installed version of the latest release. You'll be able to test
|
||||
with this version when you want to, and use the installed release
|
||||
version the rest of the time. If you ever do want to install the
|
||||
development verison please refer to INSTALL.txt.</p>
|
||||
<p>Change to the wxWidgetswxPython dir and run the this command,
|
||||
<p>Change to the %WXDIR%wxPython dir and run the this command,
|
||||
makeing sure that you use the version of python that you want to
|
||||
build for (if you have more than one on your system):</p>
|
||||
<pre class="literal-block">
|
||||
cd %WXWIN%\wxPython
|
||||
cd %WXDIR%\wxPython
|
||||
python setup.py build_ext --inplace
|
||||
</pre>
|
||||
<p>If you are wanting to have the source files regenerated with swig,
|
||||
@@ -309,15 +324,15 @@ command line. You should then end up with a set of <tt class="literal"><span cl
|
||||
files in the wx package and you'll have to run <tt class="literal"><span class="pre">python_d.exe</span></tt> to
|
||||
use them. The debug and hybrid(release) versions can coexist.</p>
|
||||
<p>When the setup.py command is done you should have fully populated
|
||||
wxPython and wx packages locally in wxWidgets/wxPython/wxPython and
|
||||
wxWidgets/wxPython/wx, with all the extension modules (<tt class="literal"><span class="pre">*.pyd</span></tt>
|
||||
wxPython and wx packages locally in %WXDIR%/wxPython/wxPython and
|
||||
%WXDIR%/wxPython/wx, with all the extension modules (<tt class="literal"><span class="pre">*.pyd</span></tt>
|
||||
files) located in the wx package.</p>
|
||||
</li>
|
||||
<li><p class="first">To run code with the development verison of wxPython, just set the
|
||||
PYTHONPATH to the wxPython dir in the CVS tree. For example:</p>
|
||||
<pre class="literal-block">
|
||||
set PYTHONPATH=e:\projects\wxWidgets\wxPython
|
||||
cd e:\projects\wxWidgets\wxPython
|
||||
set PYTHONPATH=%WXDIR%\wxPython
|
||||
cd %WXDIR\wxPython\demo
|
||||
python demo.py
|
||||
</pre>
|
||||
</li>
|
||||
|
@@ -12,11 +12,14 @@ importantly, that you know what you are doing! ;-)
|
||||
If you want to also install the version of wxPython you build to be in
|
||||
your site-packages dir and be your default version of wxPython, then a
|
||||
few additional steps are needed, and you may want to use slightly
|
||||
different options. See INSTALL.txt for more details. If you only use
|
||||
the instructions in this BUILD.txt file then you will end up with a
|
||||
separate installation of wxPython and you can switch back and forth
|
||||
between this and the release version that you may already have
|
||||
installed.
|
||||
different options. See the INSTALL_ document for more details. If
|
||||
you only use the instructions in this BUILD_ document file then you
|
||||
will end up with a separate installation of wxPython and you can
|
||||
switch back and forth between this and the release version that you
|
||||
may already have installed.
|
||||
|
||||
.. _INSTALL: INSTALL.html
|
||||
.. _BUILD: BUILD.html
|
||||
|
||||
If you want to make changes to any of the ``*.i`` files, (SWIG interface
|
||||
definition files,) or to regenerate the extension sources or renamer
|
||||
@@ -31,6 +34,13 @@ command-line variable named SWIG to be the full path name of the
|
||||
executable and the wxPython build will use it. See below for an
|
||||
example.
|
||||
|
||||
In the text below I'll use WXDIR with environment variable syntax
|
||||
(either $WXDIR or %WXDIR%) to refer to the top level directory were
|
||||
your wxWidgerts and wxPython sources are located. It will equate to
|
||||
whereever you checked out the wxWidgets module from CVS, or untarred
|
||||
the wxPythonSrc tarball to. You can either substitute the $WXDIR text
|
||||
below with your actual dir, or set the value in the environment and
|
||||
use it just like you see it below.
|
||||
|
||||
|
||||
|
||||
@@ -51,6 +61,7 @@ place, then do the same for wxPython.
|
||||
rerun the script without having to remember the options I used
|
||||
before::
|
||||
|
||||
cd $WXDIR
|
||||
mkdir bld
|
||||
cd bld
|
||||
../configure --prefix=/opt/wx/2.5 \
|
||||
@@ -116,10 +127,11 @@ place, then do the same for wxPython.
|
||||
|
||||
|
||||
3. I also have a script to help me build wxPython and it is checked in
|
||||
to the CVS as wxWidgets/wxPython/b, but probably don't want to use
|
||||
it as it's very cryptic and expects that you want to run SWIG, so
|
||||
if you don't have the latest patched up version of SWIG then you'll
|
||||
probably get stuck. So I'll just give the raw commands instead.
|
||||
to the CVS as wxWidgets/wxPython/b, but you probably don't want to
|
||||
use it as it's very cryptic and expects that you want to run SWIG,
|
||||
so if you don't have the latest patched up version of SWIG then
|
||||
you'll probably get stuck. So I'll just give the raw commands
|
||||
instead.
|
||||
|
||||
We're not going to install the development version of wxPython with
|
||||
these commands, so it won't impact your already installed version
|
||||
@@ -134,10 +146,10 @@ place, then do the same for wxPython.
|
||||
using python2.3.
|
||||
|
||||
Make sure that the first wx-config found on the PATH is the one you
|
||||
installed above, and then change to the wxWidgets/wxPython dir and
|
||||
installed above, and then change to the $WXDIR/wxPython dir and
|
||||
run the this command::
|
||||
|
||||
cd wxPython
|
||||
cd $WXDIR/wxPython
|
||||
python2.3 setup.py build_ext --inplace --debug
|
||||
|
||||
If your new wx-config script is not on the PATH, or there is some
|
||||
@@ -163,24 +175,25 @@ place, then do the same for wxPython.
|
||||
module.
|
||||
|
||||
When the setup.py command is done you should have fully populated
|
||||
wxPython and wx packages locally in wxWidgets/wxPython/wxPython and
|
||||
.../wx, with all the extension modules (``*.so`` files) located in the
|
||||
wx package.
|
||||
wxPython and wx packages locally in $WXDIR/wxPython/wxPython and
|
||||
$WXDIR/wxPython/wx, with all the extension modules (``*.so`` files)
|
||||
located in the wx package.
|
||||
|
||||
|
||||
4. To run code with the development verison of wxPython, just set the
|
||||
PYTHONPATH to the wxPython dir in the CVS tree. For example::
|
||||
PYTHONPATH to the wxPython dir located in the source tree. For
|
||||
example::
|
||||
|
||||
export LD_LIBRARY=/opt/wx/2.5/lib
|
||||
export PYTHONPATH=/myprojects/wxWidgets/wxPython
|
||||
cd /myprojects/wxWidgets/wxPython/demo
|
||||
export LD_LIBRARY_PATH=/opt/wx/2.5/lib
|
||||
export PYTHONPATH=$WXDIR/wxPython
|
||||
cd $WXDIR/wxPython/demo
|
||||
python2.3 demo.py
|
||||
|
||||
OS X NOTE: You need to use "pythonw" on the command line to run
|
||||
wxPython applications. This version of the Python executable is
|
||||
part of the Python Framework and is allowed to interact with the
|
||||
display. You can also double click on a .py or a .pyw file from
|
||||
the finder (assuming that PythonLauncher is still associated with
|
||||
the finder (assuming that the PythonLauncher app is associated with
|
||||
these file extensions) and it will launch the Framework version of
|
||||
Python for you. For information about creating Applicaiton Bundles
|
||||
of your wxPython apps please see the wiki and the mail lists.
|
||||
@@ -207,10 +220,11 @@ modules using that compiler, and then make a few changes to setup.py
|
||||
to accomodate that. (And send the patches to me.) If you plan on
|
||||
using VisualStudio.Net (a.k.a. MSVC 7.1) keep in mind that you'll also
|
||||
have to build Python and any other extension modules that you use with
|
||||
that compiler because a different version of the C runtime likbrary is
|
||||
that compiler because a different version of the C runtime library is
|
||||
used. The Python executable that comes from PythonLabs and the
|
||||
wxPython extensions that I distribute are built with MSVC 6 with all
|
||||
the Service Packs applied.
|
||||
the Service Packs applied. This policy will change with Python 2.4
|
||||
and MSVC 7.1 will be used starting with that version.
|
||||
|
||||
If you want to build a debugable version of wxWidgets and wxPython you
|
||||
will need to have also built a debug version of Python and any other
|
||||
@@ -223,25 +237,28 @@ it.
|
||||
|
||||
Just like the unix versions I also use some scripts to help me build
|
||||
wxWidgets, but I use some non-standard stuff to do it. So if you want
|
||||
to use them too you'll need to get a copy or 4DOS or 4NT from
|
||||
to use my scripts you'll need to get a copy or 4DOS or 4NT from
|
||||
http://www.jpsoft.com/ and also a copy of unix-like cat and sed
|
||||
programs. You can also do by hand what my scripts are doing, but
|
||||
there are a lof steps involved and I won't be going into details
|
||||
here. There is a copy of my build scripts in wxWidgets\wxPython\distrib\msw
|
||||
there are alot of steps involved and I won't be going into details
|
||||
here. There is a copy of my build scripts in %WXDIR%\wxPython\distrib\msw
|
||||
that you can use for reference (if you don't use them directly) for
|
||||
adapting these instructions to your specific needs. The directions
|
||||
below assume that you are using my scripts.
|
||||
|
||||
|
||||
1. Set an environment variable to the root of the wxWidgets source
|
||||
tree::
|
||||
tree. This is used by the makefiles::
|
||||
|
||||
set WXWIN=e:\projects\wxWidgets
|
||||
set WXWIN=%WXDIR%
|
||||
|
||||
2. Copy setup0.h to setup.h
|
||||
|
||||
cd %WXWIN%\include\wx\msw
|
||||
cd %WXDIR%\include\wx\msw
|
||||
copy setup0.h setup.h
|
||||
|
||||
|
||||
3. Edit %WXWIN%\include\wx\msw\setup.h and change a few settings.
|
||||
3. Edit %WXDIR%\include\wx\msw\setup.h and change a few settings.
|
||||
Some of them are changed by my build scripts depending on the type
|
||||
of build (debug/hybrid, unicode/ansi). I change a few of the other
|
||||
defaults to have these values::
|
||||
@@ -256,13 +273,14 @@ here. There is a copy of my build scripts in wxWidgets\wxPython\distrib\msw
|
||||
wxUSE_DISPLAY 1
|
||||
|
||||
|
||||
4. Make sure that %WXWIN%\lib\vc_dll directory is on the PATH. The
|
||||
4. Make sure that %WXDIR%\lib\vc_dll directory is on the PATH. The
|
||||
wxWidgets DLLs will end up there as part of the build and so you'll
|
||||
need it on the PATH for them to be found at runtime.
|
||||
|
||||
|
||||
5. Change to the %WXWIN%\build\msw directory and copy my build scripts
|
||||
there.
|
||||
5. Change to the %WXDIR%\build\msw directory and copy my build scripts
|
||||
there from their default location in %WXDIR%\wxPython\distrib\msw
|
||||
if they are not present already.
|
||||
|
||||
|
||||
6. Use the .make.btm command to build wxWidgets. It needs one
|
||||
@@ -301,11 +319,11 @@ here. There is a copy of my build scripts in wxWidgets\wxPython\distrib\msw
|
||||
version the rest of the time. If you ever do want to install the
|
||||
development verison please refer to INSTALL.txt.
|
||||
|
||||
Change to the wxWidgets\wxPython dir and run the this command,
|
||||
Change to the %WXDIR%\wxPython dir and run the this command,
|
||||
makeing sure that you use the version of python that you want to
|
||||
build for (if you have more than one on your system)::
|
||||
|
||||
cd %WXWIN%\wxPython
|
||||
cd %WXDIR%\wxPython
|
||||
python setup.py build_ext --inplace
|
||||
|
||||
If you are wanting to have the source files regenerated with swig,
|
||||
@@ -326,16 +344,16 @@ here. There is a copy of my build scripts in wxWidgets\wxPython\distrib\msw
|
||||
use them. The debug and hybrid(release) versions can coexist.
|
||||
|
||||
When the setup.py command is done you should have fully populated
|
||||
wxPython and wx packages locally in wxWidgets/wxPython/wxPython and
|
||||
wxWidgets/wxPython/wx, with all the extension modules (``*.pyd``
|
||||
wxPython and wx packages locally in %WXDIR%/wxPython/wxPython and
|
||||
%WXDIR%/wxPython/wx, with all the extension modules (``*.pyd``
|
||||
files) located in the wx package.
|
||||
|
||||
|
||||
9. To run code with the development verison of wxPython, just set the
|
||||
PYTHONPATH to the wxPython dir in the CVS tree. For example::
|
||||
|
||||
set PYTHONPATH=e:\projects\wxWidgets\wxPython
|
||||
cd e:\projects\wxWidgets\wxPython
|
||||
set PYTHONPATH=%WXDIR%\wxPython
|
||||
cd %WXDIR\wxPython\demo
|
||||
python demo.py
|
||||
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
<div class="document" id="recent-changes-for-wxpython">
|
||||
<h1 class="title">Recent Changes for wxPython</h1>
|
||||
<div class="section" id="id1">
|
||||
<h1><a name="id1">2.5.1.4</a></h1>
|
||||
<h1><a name="id1">2.5.1.5</a></h1>
|
||||
<p>(See also the <a class="reference" href="MigrationGuide.html">MigrationGuide</a> file for details about some of the
|
||||
big changes that have happened in this release and how you should
|
||||
adapt your code.)</p>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Recent Changes for wxPython
|
||||
=====================================================================
|
||||
|
||||
2.5.1.4
|
||||
2.5.1.5
|
||||
-------
|
||||
|
||||
(See also the MigrationGuide_ file for details about some of the
|
||||
|
@@ -11,10 +11,10 @@
|
||||
<div class="document" id="installing-wxpython-2-5-from-source">
|
||||
<h1 class="title">Installing wxPython 2.5 from Source</h1>
|
||||
<p>This document will describe the few differences and additions to the
|
||||
content in BUILD.txt for installing wxPython built from source.
|
||||
Please follow the intstructions both in this file and in BUILD.txt to
|
||||
perform this task. Where there is overlap the items described here
|
||||
will take precedence.</p>
|
||||
content in the <a class="reference" href="BUILD.html">BUILD</a> document for installing wxPython built from
|
||||
source. Please follow the intstructions both in this file and in
|
||||
<a class="reference" href="BUILD.html">BUILD</a> to perform this task. Where there is overlap the items
|
||||
described here will take precedence for doing installations.</p>
|
||||
<div class="section" id="installing-on-unix-like-systems-not-os-x">
|
||||
<h1><a name="installing-on-unix-like-systems-not-os-x">Installing on Unix-like Systems (not OS X)</a></h1>
|
||||
<ol class="arabic">
|
||||
@@ -38,10 +38,10 @@ runtime assertions turned into Python exceptions where possible.
|
||||
It does add extra code to the build but probably not enough to
|
||||
worry about it. However if you want to get as lean a build as
|
||||
possible you can leave it out, but if your code does something bad
|
||||
then instead of exceptions you'll likely get a crash.</p>
|
||||
<blockquote>
|
||||
<p>--enable-debug_flag </p>
|
||||
</blockquote>
|
||||
then instead of exceptions you'll likely get a crash:</p>
|
||||
<pre class="literal-block">
|
||||
--enable-debug_flag \
|
||||
</pre>
|
||||
<p>If you are building a private copy of wxWidgets (IOW, not installed
|
||||
in a standard library location) then it can be kind of a hassle to
|
||||
always have to set the LD_LIBRARY_PATH variable so wxPython can
|
||||
|
@@ -3,10 +3,12 @@ Installing wxPython 2.5 from Source
|
||||
|
||||
|
||||
This document will describe the few differences and additions to the
|
||||
content in BUILD.txt for installing wxPython built from source.
|
||||
Please follow the intstructions both in this file and in BUILD.txt to
|
||||
perform this task. Where there is overlap the items described here
|
||||
will take precedence.
|
||||
content in the BUILD_ document for installing wxPython built from
|
||||
source. Please follow the intstructions both in this file and in
|
||||
BUILD_ to perform this task. Where there is overlap the items
|
||||
described here will take precedence for doing installations.
|
||||
|
||||
.. _BUILD: BUILD.html
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +37,7 @@ Installing on Unix-like Systems (not OS X)
|
||||
It does add extra code to the build but probably not enough to
|
||||
worry about it. However if you want to get as lean a build as
|
||||
possible you can leave it out, but if your code does something bad
|
||||
then instead of exceptions you'll likely get a crash.
|
||||
then instead of exceptions you'll likely get a crash::
|
||||
|
||||
--enable-debug_flag \
|
||||
|
||||
|
@@ -1,31 +1,31 @@
|
||||
This sample shows how to embed wxPython into a wxWindows application.
|
||||
This sample shows how to embed wxPython into a wxWidgets application.
|
||||
There are a few little tricks needed to make it work, but once over
|
||||
the hurdle it should work just fine for you. I'll try to describe the
|
||||
build issues here, see the code and comments in embedded.cpp for
|
||||
examples of how to use it.
|
||||
|
||||
1. The most important thing is that your wx application and wxPython
|
||||
must use the same version and the same instance of wxWindows. That
|
||||
means that you can not statically link your app with wxWindows, but
|
||||
must use a dynamic library for wxWindows.
|
||||
must use the same version and the same instance of wxWidgets. That
|
||||
means that you can not statically link your app with wxWidgets, but
|
||||
must use a dynamic library for wxWidgets.
|
||||
|
||||
2. You must ensure that your app and wxPython are using the same
|
||||
wxWindows DLL. By default on MSW wxPython installs the wxWindows
|
||||
wxWidgets DLL. By default on MSW wxPython installs the wxWidgets
|
||||
DLL to a directory not on the PATH, so you may have to do something
|
||||
creative to make that happen. But because of #3 this may not be
|
||||
that big of a problem.
|
||||
|
||||
3. wxPython, your app and wxWindows must be built with the same flags
|
||||
3. wxPython, your app and wxWidgets must be built with the same flags
|
||||
and settings. This probably means that you will need to rebuild
|
||||
wxPython yourself. It may be possible for me to distribute the
|
||||
setup.h and etc. that I use, but you'll need to rebuild everything
|
||||
yourself anyway to get debugger versions so I'm not too worried
|
||||
about it just yet. BTW, on MSW if you do a FINAL=0 build (full
|
||||
debug version) then you will need to have a debug version of Python
|
||||
built too since it expects to have extension modules in files with
|
||||
a _d in the name. If you do a FINAL=hybrid build then you will be
|
||||
able to use the stock version of Python, but you won't be able to
|
||||
trace through the PYTHON API functions.
|
||||
wxPython yourself. I do distribute the setup.h, other headers,
|
||||
import libs and etc. that I use, but you'll need to rebuild
|
||||
everything yourself anyway to get debugger versions so I'm not too
|
||||
worried about it just yet. BTW, on MSW if you do debug builds of
|
||||
your app and wxPython then you will need to have a debug version of
|
||||
Python built too since it expects to have extension modules in
|
||||
files with a _d in the name. If you do a hybrid build then you
|
||||
will be able to use the stock version of Python, but you won't be
|
||||
able to trace through the PYTHON API functions.
|
||||
|
||||
4. I expect that most of these issues will be much more minor on
|
||||
Unix. ;-)
|
||||
|
@@ -11,6 +11,9 @@
|
||||
// Licence: wxWindows license
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
@@ -29,8 +32,8 @@
|
||||
#endif
|
||||
|
||||
// Import Python and wxPython headers
|
||||
#include <Python.h>
|
||||
#include <wxPython.h>
|
||||
#include <wx/wxPython/wxPython.h>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class definitions
|
||||
@@ -41,6 +44,8 @@ public:
|
||||
virtual bool OnInit();
|
||||
virtual ~MyApp();
|
||||
void Init_wxPython();
|
||||
private:
|
||||
PyThreadState* m_mainTState;
|
||||
};
|
||||
|
||||
|
||||
@@ -77,29 +82,25 @@ void MyApp::Init_wxPython()
|
||||
Py_Initialize();
|
||||
PyEval_InitThreads();
|
||||
|
||||
// Load the wxPython core API. Imports the wxPython.wxc
|
||||
// module and sets a pointer to a function table located there.
|
||||
// Load the wxPython core API. Imports the wx._core module and sets a
|
||||
// local pointer to a function table located there.
|
||||
wxPyCoreAPI_IMPORT();
|
||||
|
||||
// Ensure that the new classes defined in the wxPython wrappers are
|
||||
// recognised by the wx RTTI system. (If you don't use wxWindows in
|
||||
// your C++ app you won't need to do this.)
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
// Save the current Python thread state and release the
|
||||
// Global Interpreter Lock.
|
||||
wxPyBeginAllowThreads();
|
||||
m_mainTState = wxPyBeginAllowThreads();
|
||||
}
|
||||
|
||||
|
||||
MyApp::~MyApp()
|
||||
{
|
||||
// Restore the thread state and tell Python to cleanup after itself.
|
||||
wxPyEndAllowThreads(true);
|
||||
// wxPython will do its own cleanup as part of that process.
|
||||
wxPyEndAllowThreads(m_mainTState);
|
||||
Py_Finalize();
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -126,10 +127,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
|
||||
wxMenuBar* mbar = new wxMenuBar;
|
||||
wxMenu* menu = new wxMenu;
|
||||
menu->Append(ID_PYFRAME, "Make wx&Python frame");
|
||||
menu->Append(ID_PYFRAME, _T("Make wx&Python frame"));
|
||||
menu->AppendSeparator();
|
||||
menu->Append(ID_EXIT, "&Close Frame\tAlt-X");
|
||||
mbar->Append(menu, "&File");
|
||||
menu->Append(ID_EXIT, _T("&Close Frame\tAlt-X"));
|
||||
mbar->Append(menu, _T("&File"));
|
||||
SetMenuBar(mbar);
|
||||
|
||||
CreateStatusBar();
|
||||
@@ -140,7 +141,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
wxPanel* p1 = new wxPanel(sp, -1);
|
||||
p1->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD));
|
||||
new wxStaticText(p1, -1,
|
||||
wxT("The frame, menu, splitter, this panel and this text were created in C++..."),
|
||||
_T("The frame, menu, splitter, this panel and this text were created in C++..."),
|
||||
wxPoint(10,10));
|
||||
|
||||
// And get a panel from Python
|
||||
@@ -156,12 +157,12 @@ void MyFrame::OnExit(wxCommandEvent& event)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// This is were the fun begins...
|
||||
// This is where the fun begins...
|
||||
|
||||
|
||||
char* python_code1 = "\
|
||||
from wxPython.wx import wxFrame\n\
|
||||
f = wxFrame(None, -1, 'Hello from wxPython!', size=(250, 150))\n\
|
||||
import wx\n\
|
||||
f = wx.Frame(None, -1, 'Hello from wxPython!', size=(250, 150))\n\
|
||||
f.Show()\n\
|
||||
";
|
||||
|
||||
@@ -191,8 +192,8 @@ void MyFrame::RedirectStdio()
|
||||
// only on demand when something is printed, like a traceback.
|
||||
char* python_redirect = "\
|
||||
import sys\n\
|
||||
from wxPython.wx import wxPyOnDemandOutputWindow\n\
|
||||
output = wxPyOnDemandOutputWindow()\n\
|
||||
import wx\n\
|
||||
output = wx.PyOnDemandOutputWindow()\n\
|
||||
sys.stdin = sys.stderr = output\n\
|
||||
";
|
||||
bool blocked = wxPyBeginBlockThreads();
|
||||
@@ -204,6 +205,8 @@ sys.stdin = sys.stderr = output\n\
|
||||
|
||||
|
||||
char* python_code2 = "\
|
||||
import sys\n\
|
||||
sys.path.append('.')\n\
|
||||
import embedded_sample\n\
|
||||
\n\
|
||||
def makeWindow(parent):\n\
|
||||
@@ -239,7 +242,7 @@ wxWindow* MyFrame::DoPythonStuff(wxWindow* parent)
|
||||
// Was there an exception?
|
||||
if (! result) {
|
||||
PyErr_Print();
|
||||
wxPyEndBlockThreads();
|
||||
wxPyEndBlockThreads(blocked);
|
||||
return NULL;
|
||||
}
|
||||
Py_DECREF(result);
|
||||
@@ -254,7 +257,6 @@ wxWindow* MyFrame::DoPythonStuff(wxWindow* parent)
|
||||
// wxPython object that wraps it.
|
||||
PyObject* arg = wxPyMake_wxObject(parent);
|
||||
wxASSERT(arg != NULL);
|
||||
|
||||
PyObject* tuple = PyTuple_New(1);
|
||||
PyTuple_SET_ITEM(tuple, 0, arg);
|
||||
result = PyEval_CallObject(func, tuple);
|
||||
@@ -265,8 +267,8 @@ wxWindow* MyFrame::DoPythonStuff(wxWindow* parent)
|
||||
else {
|
||||
// Otherwise, get the returned window out of Python-land and
|
||||
// into C++-ville...
|
||||
bool error = SWIG_GetPtrObj(result, (void**)&window, "_wxWindow_p");
|
||||
wxASSERT_MSG(!error, wxT("Returned object was not a wxWindow!"));
|
||||
bool success = wxPyConvertSwigPtr(result, (void**)&window, _T("wxWindow"));
|
||||
wxASSERT_MSG(success, _T("Returned object was not a wxWindow!"));
|
||||
Py_DECREF(result);
|
||||
}
|
||||
|
||||
|
@@ -1,24 +1,21 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.PyCrust import shell, version
|
||||
import wx
|
||||
from wx.py import shell, version
|
||||
|
||||
class MyPanel(wxPanel):
|
||||
class MyPanel(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
print parent
|
||||
wx.Panel.__init__(self, parent, -1)
|
||||
|
||||
text = wxStaticText(self, -1,
|
||||
text = wx.StaticText(self, -1,
|
||||
"Everything on this side of the splitter comes from Python.")
|
||||
text.SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD))
|
||||
text.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD))
|
||||
|
||||
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % version.VERSION
|
||||
pycrust = shell.Shell(self, -1, introText=intro)
|
||||
#pycrust = wxTextCtrl(self, -1, intro)
|
||||
|
||||
sizer = wxBoxSizer(wxVERTICAL)
|
||||
sizer.Add(text, 0, wxEXPAND|wxALL, 10)
|
||||
sizer.Add(pycrust, 1, wxEXPAND|wxBOTTOM|wxLEFT|wxRIGHT, 10)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(text, 0, wx.EXPAND|wx.ALL, 10)
|
||||
sizer.Add(pycrust, 1, wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, 10)
|
||||
|
||||
self.SetSizer(sizer)
|
||||
#self.SetAutoLayout(true)
|
||||
#self.Layout()
|
||||
|
||||
|
@@ -12,20 +12,23 @@
|
||||
PROGRAM = embedded
|
||||
OBJECTS = $(PROGRAM).o
|
||||
|
||||
EXTRAINC=-I../../src -I/usr/include/python2.2
|
||||
EXTRALIB=-L/usr/lib/python2.2/config -lpython2.2
|
||||
CXX = $(shell wx-config --cxx)
|
||||
#WX_CFG = wx-config
|
||||
WX_CFG = wxgtk2ud-2.5-config
|
||||
|
||||
EXTRAINC=-I../../include -I/usr/include/python2.3
|
||||
EXTRALIB=-L/usr/lib/python2.3/config -lpython2.3
|
||||
CXX = $(shell $(WX_CFG) --cxx)
|
||||
|
||||
|
||||
.SUFFIXES: .o .cpp
|
||||
|
||||
.cpp.o :
|
||||
$(CXX) -c `wx-config --cxxflags` $(EXTRAINC) -o $@ $<
|
||||
$(CXX) -c -g `$(WX_CFG) --cxxflags` $(EXTRAINC) -o $@ $<
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
$(PROGRAM): $(OBJECTS)
|
||||
$(CXX) -o $(PROGRAM) $(OBJECTS) `wx-config --libs` $(EXTRALIB)
|
||||
$(CXX) -g -o $(PROGRAM) $(OBJECTS) `$(WX_CFG) --libs` $(EXTRALIB)
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAM)
|
||||
|
@@ -1,13 +1,30 @@
|
||||
#
|
||||
# Makefile for Windows and MS VIsual C++
|
||||
#
|
||||
# Currently just setup for the debug version, you'll need a debug
|
||||
# version of Python (*_d.*) and wxPython to run this.
|
||||
|
||||
|
||||
WXDIR = $(WXWIN)
|
||||
PYTHONDIR = d:\tools\Python22
|
||||
PYTHONDIR = c:\tools\Python23
|
||||
VER = 25d
|
||||
|
||||
PROGRAM = embedded
|
||||
OBJECTS = $(PROGRAM).obj
|
||||
EXTRAINC = /I$(PYTHONDIR)\include /I$(WXDIR)/wxPython/src
|
||||
EXTRALIBS = /LIBPATH:$(PYTHONDIR)\libs
|
||||
INCLUDES = -I$(WXDIR)\lib\vc_dll\mswd -I$(WXDIR)\include -I$(WXDIR)\wxPython\include -I$(PYTHONDIR)\include -I$(PYTHONDIR)\PC
|
||||
CXXFLAGS = /c /nologo /Od /MDd /W3 /GX /Z7 /D_DEBUG -DWIN32 -D_WINDOWS -D__WXMSW__ -DWXUSINGDLL=1 -DWXP_USE_THREAD=1 -UNDEBUG -D__WXDEBUG__ /Gy
|
||||
LIBFLAGS = /nologo /pdb:None /DEBUG /LIBPATH:$(WXDIR)\lib\vc_dll /LIBPATH:$(PYTHONDIR)\libs
|
||||
LIBS = wxbase$(VER).lib wxmsw$(VER)_core.lib \
|
||||
kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib \
|
||||
shell32.lib oldnames.lib comctl32.lib odbc32.lib ole32.lib oleaut32.lib \
|
||||
uuid.lib rpcrt4.lib advapi32.lib wsock32.lib
|
||||
|
||||
!include $(WXDIR)\src\makeprog.vc
|
||||
|
||||
all : embedded.exe
|
||||
clean :
|
||||
del *.obj
|
||||
del *.exe
|
||||
|
||||
embedded.obj : embedded.cpp
|
||||
cl $(INCLUDES) $(CXXFLAGS) /Fo$@ embedded.cpp
|
||||
|
||||
embedded.exe : embedded.obj
|
||||
link $(LIBFLAGS) embedded.obj $(LIBS) /OUT:$@
|
||||
|
@@ -723,6 +723,16 @@ void wxPy_ReinitStockObjects(int pass)
|
||||
else if (pass == 2) { rsoPass2(#name); } \
|
||||
else if (pass == 3) { rsoPass3(#name, #classname, (void*)&name); }
|
||||
|
||||
// If there is already an App object then wxPython is probably embedded in
|
||||
// a wx C++ application, so there is no need to do all this.
|
||||
static bool embedded = false;
|
||||
if ((pass == 1 || pass == 2) && wxTheApp) {
|
||||
embedded = true;
|
||||
return;
|
||||
}
|
||||
if (pass == 3 && embedded)
|
||||
return;
|
||||
|
||||
|
||||
REINITOBJ(wxNORMAL_FONT, wxFont);
|
||||
REINITOBJ(wxSMALL_FONT, wxFont);
|
||||
|
Reference in New Issue
Block a user