我正在使用wxPython创建一个使用wxWizard控件的向导。我试图画一个彩色矩形,但当我运行这个应用程序时,似乎有一个大约10像素的填充在每边的矩形。这也适用于所有其他控件。我得把它们偏移一点,这样它们就会出现在我想要的地方。我有什么办法可以把这个衬垫去掉吗?这是我的基本向导页面的源代码。
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
谢谢各位。