]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-11/blockwindow.py
3 class BlockWindow(wx
.Panel
):
4 def __init__(self
, parent
, ID
=-1, label
="",
5 pos
=wx
.DefaultPosition
, size
=(100, 25)):
6 wx
.Panel
.__init
__(self
, parent
, ID
, pos
, size
,
7 wx
.RAISED_BORDER
, label
)
9 self
.SetBackgroundColour("white")
11 self
.Bind(wx
.EVT_PAINT
, self
.OnPaint
)
13 def OnPaint(self
, evt
):
14 sz
= self
.GetClientSize()
16 w
,h
= dc
.GetTextExtent(self
.label
)
17 dc
.SetFont(self
.GetFont())
18 dc
.DrawText(self
.label
, (sz
.width
-w
)/2, (sz
.height
-h
)/2)