문제

I have a FlexGridSizer that I add a bunch of TextCtrl to, some of which are for users to enter a path, so I have a Button in the adjacent column to the right of those TextCtrl boxes. The label text is ... and I only call AddGrowableCol on the columns with TextCtrl in them... here is how I'm adding the Button in my for loop (I don't use addmany):

widgetItem = wx.Button(parent, -1, "...")
widgetItem.row=rowNum
widgetItem.col=colNum
widgetItem.target = lastTextBox
self.Bind(wx.EVT_BUTTON, self.getFile, widgetItem)
currentSizer.AddF(widgetItem, wx.SizerFlags(0).Border(wx.ALL, 5))
도움이 되었습니까?

해결책

Ah, what I was thinking would be called shrink-wrapped or shrink-to-fit, is called exactfit by wxPython: wxPython docs on Button class, style section

wx.BU_EXACTFIT

here is how I had to instantiate the Button:

widgetItem = wx.Button(parent, -1, "...", style=wx.BU_EXACTFIT)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top