def __init__(self, parent):
self.panel = wx.ScrolledWindow.__init__(self, parent)
self.SetScrollRate(5, 5)
self.panelphase = self.GetParent().panelphase
self.panelvisual = self.GetParent().panelvisual
self.cmvbox = wx.BoxSizer(wx.VERTICAL)
self.cmhbox = []
self.imglist = []
self.sellist = []
self.rb = []
self.chkb = []
array = self.panelphase.cms[0][1]
dc = wx.ScreenDC()
dc.SetFont(self.panelvisual.font)
w,h = dc.GetTextExtent("TestString")
height = h
if IsNotWX4():
image = wx.EmptyImage(array.shape[0],height)
else:
image = wx.Image(array.shape[0],height)
newarray = numpy.zeros((height, array.shape[0], 3), dtype=numpy.uint8)
for i in range(self.panelphase.cms.shape[0]):
self.cmhbox.append( wx.BoxSizer(wx.HORIZONTAL) )
name = self.panelphase.cms[i][0]
array = self.panelphase.cms[i][1]
for j in range(height):
newarray[j,:,:] = numpy.uint8(255.0*array)
image.SetData( newarray.tostring())
bmp = image.ConvertToBitmap()
self.imglist.append(wx.StaticBitmap(self, -1, bmp))
self.rb.append( wx.RadioButton(self, -1, label=name, size=(160, height) ) )
self.cmhbox[-1].Add(self.rb[-1], 0)
self.cmhbox[-1].Add((5, -1))
self.cmhbox[-1].Add(self.imglist[-1], 1, wx.EXPAND)
self.chkb.append( wx.CheckBox(self, -1, 'Reverse', size=(160, height)) )
self.cmhbox[-1].Add(self.chkb[-1], 0, wx.EXPAND)
self.cmvbox.Add(self.cmhbox[-1], 1, wx.EXPAND)
self.SetSizer(self.cmvbox)
self.Fit()
self.Layout()
self.Show()
评论列表
文章目录