我想做的是制作一个4X3 Gridsizer并将我的对象附着在每个点上,但是当我运行它时,它似乎运行得很好,但是所有东西都被弄脏了。我看不到我做错了什么。下面是程序那部分的代码
class F_WaferMaps ( wx.Frame ):
def __init__( self, parent, dateBegin , dateEnd):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 800,500 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
gSizer1 = wx.GridSizer( 4, 3, 3,3 )
waferDesign = WaferInfo(die_size = (.3,.45),center_xy= (10 ,6.5), dia= 6.0 , edge_excl= 0.0 )
waferInfo = pd.read_excel("file.xlsx", index_col= None, na_values=['NA'] , usecols=[18,4,5,21,2])
df2 = waferInfo[(waferInfo.FILE_FINISH_TS >= dateBegin) & (waferInfo.FILE_FINISH_TS <= dateEnd) ]
waferSubSet = df2[['X', 'Y' , 'HB', 'TIME' , 'LOT']]
df3 = waferSubSet[~(waferSubSet[['X_COORD', 'Y_COORD', 'LOT_WF']].duplicated(keep = 'last'))]
a = 0
self.hbox = wx.BoxSizer(wx.HORIZONTAL)
self.vbox = wx.BoxSizer(wx.VERTICAL)
waferNum = 0
for lotID, wafNum in df3.groupby(['LOT_WF']):
df4 = wafNum[['X_COORD', 'Y_COORD', 'HB_NUM']]
print(wafNum)
print("\n")
my_list = df4.transform(tuple, axis=1).tolist()
self.panels = wm_core.WaferMapPanel(self, my_list, waferDesign, data_type='discrete'.lower())
gSizer1.Add(self.panels,1)
waferNum += 1
self.SetSizer( gSizer1 )
self.Layout()
self.Centre( wx.BOTH )
所以我希望我的输出看起来像
A B C
D E F
G H I
J K M
但是我得到的是类似
A
B
C
D
E
etc
下面是WaferMapApp的类,如注释中所要求的
def _init_ui(self):
"""Create the UI Elements and bind various events."""
# Create items to add to our layout
self.canvas = FloatCanvas.FloatCanvas(self,
BackgroundColor="BLACK",
)
# Initialize the FloatCanvas. Needs to come before adding items!
self.canvas.InitAll()
# Create the legend
self._create_legend()
# Draw the die and wafer objects (outline, crosshairs, etc) on the canvas
self.draw_die()
if self.plot_die_centers:
self.draw_die_center()
self.draw_wafer_objects()
# Bind events to the canvas
self._bind_events()
# Create layout manager and add items
self.hbox = wx.BoxSizer(wx.HORIZONTAL)
self.hbox.Add(self.legend, 0, wx.EXPAND)
self.hbox.Add(self.canvas, 1, wx.EXPAND)
self.SetSizer(self.hbox)
我不确定是否是引起问题的布局