0
我正在使用wxPizard创建一个使用wxWizard控件的向导。我试图绘制一个彩色的矩形,但是当我运行应用程序时,似乎在矩形的每一边都有一个大约10px的填充。这也适用于所有其他控件。我必须稍微抵消它们,以便它们恰好出现在我想要的位置。有什么办法可以删除这个填充?这是我的基本向导页面的来源。删除wxPython的wxWizard中的填充
class SimplePage(wx.wizard.PyWizardPage):
"""
Simple wizard page with unlimited rows of text.
"""
def __init__(self, parent, title):
wx.wizard.PyWizardPage.__init__(self, parent)
self.next = self.prev = None
#self.sizer = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, -1, title)
title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
#self.sizer.AddWindow(title, 0, wx.ALIGN_LEFT|wx.ALL, padding)
#self.sizer.AddWindow(wx.StaticLine(self, -1), 0, wx.EXPAND|wx.ALL, padding)
# self.SetSizer(self.sizer)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def OnPaint(self, evt):
"""set up the device context (DC) for painting"""
self.dc = wx.PaintDC(self)
self.dc.BeginDrawing()
self.dc.SetPen(wx.Pen("grey",style=wx.TRANSPARENT))
self.dc.SetBrush(wx.Brush("grey", wx.SOLID))
# set x, y, w, h for rectangle
self.dc.DrawRectangle(0,0,500, 500)
self.dc.EndDrawing()
del self.dc
def SetNext(self, next):
self.next = next
def SetPrev(self, prev):
self.prev = prev
def GetNext(self):
return self.next
def GetPrev(self):
return self.prev
def Activated(self, evt):
"""
Executed when page is being activated.
"""
return
def Blocked(self, evt):
"""
Executed when page is about to be switched. Switching can be
blocked by returning True.
"""
return False
def Cancel(self, evt):
"""
Executed when wizard is about to be canceled. Canceling can be
blocked by returning False.
"""
return True
谢谢你们。
我试过你的例子,它工作的很好,然后我再次尝试我的,它没有,区别在于使用'Wizard.Show ()'方法和我正在使用的'Wizard.RunWizard()'方法,我又回到阅读文档。 o有一个默认的5px或其他东西的边框。我使用下面的命令,它的边界消失了'Wizard.SetBorder(-5)'。这与sizer有关,但我没有使用。糟糕的做法,我知道。不过谢谢。 – 2010-05-18 12:43:22