0
wxPython을 사용하여 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.RunWizard()'메서드를 사용하여 문서를 다시 읽었습니다. o 기본값이 5px 또는 무언가입니다. 나는 다음 명령을 사용하여 테두리가 없어졌다.'Wizard.SetBorder (-5)'. sizer와 관련이 있지만 아무 것도 사용하지 않습니다. 나쁜 습관, 알아. 그래도 고마워. –