def OnNew_data(self, event): print("from OnNew_data") self.il = ImageListCtrl(self) print("here 01") self.mid_sizer.Hide(0) self.mid_sizer.Remove(0) print("here 02") for times in range(5): data2d = build_np_img(width=5, height=3) my_bitmap = GetBitmap_from_np_array(data2d) self.il.AppendBitmap(my_bitmap) self.mid_sizer = wx.BoxSizer(wx.VERTICAL) self.mid_sizer.Add(self.il, 1, wx.EXPAND) print("here 03") self.sizer.Add(self.il, 1, wx.EXPAND) print("here 04") self.Refresh() self.Update() self.Layout() self.Fit() wx.Yield()
def OnNew_data(self, event): print "from OnNew_data" self.il = ImageListCtrl(self) print "here 01" self.mid_sizer.Hide(0) self.mid_sizer.Remove(0) print "here 02" for times in range(5): data2d = build_np_img(width=5, height=3) my_bitmap = GetBitmap_from_np_array(data2d) self.il.AppendBitmap(my_bitmap) self.mid_sizer = wx.BoxSizer(wx.VERTICAL) self.mid_sizer.Add(self.il, 1, wx.EXPAND) print "here 03" self.sizer.Add(self.il, 1, wx.EXPAND) print "here 04" self.Refresh() self.Update() self.Layout() self.Fit() wx.Yield()
def onAddWidget(self, event): self.number_of_img += 1 label = "Button %s" % self.number_of_img name = "button%s" % self.number_of_img data2d = build_np_img(width=5, height=8) bitmap = GetBitmap_from_np_array(data2d) bitmap_tmp = wx.StaticBitmap(self, bitmap=bitmap) self.widgetSizer.Add(bitmap_tmp, 0, wx.ALL, 5) self.frame.fSizer.Layout() self.frame.Fit()
def onAddWidget(self, event): self.number_of_img += 1 label = "Button %s" % self.number_of_img name = "button%s" % self.number_of_img data2d = build_np_img(width=5, height=8) bitmap = GetBitmap_from_np_array(data2d) bitmap_tmp = wx.StaticBitmap(self, bitmap=bitmap) self.widgetSizer.Add(bitmap_tmp, 0, wx.ALL, 5) self.frame.fSizer.Layout() self.frame.Fit()
def on_V_add(self, event): print "from on_V_add" self.widgetSizer.append(wx.BoxSizer(wx.HORIZONTAL)) self.mainSizer.Add(self.widgetSizer[self.number_of_floors], 0, wx.CENTER|wx.ALL, 10) for n_siz in range(self.number_of_img): data2d = build_np_img(width=5, height=3) bitmap = GetBitmap_from_np_array(data2d) bitmap_tmp = wx.StaticBitmap(self, bitmap=bitmap) self.widgetSizer[self.number_of_floors].Add(bitmap_tmp, 0, wx.ALL, 5) self.number_of_floors += 1 self.frame.fSizer.Layout() self.frame.Fit()
def on_V_add(self, event): print("from on_V_add") self.widgetSizer.append(wx.BoxSizer(wx.HORIZONTAL)) self.mainSizer.Add(self.widgetSizer[self.number_of_floors], 0, wx.CENTER | wx.ALL, 10) for n_siz in range(self.number_of_img): data2d = build_np_img(width=5, height=3) bitmap = GetBitmap_from_np_array(data2d) bitmap_tmp = wx.StaticBitmap(self, bitmap=bitmap) self.widgetSizer[self.number_of_floors].Add( bitmap_tmp, 0, wx.ALL, 5) self.number_of_floors += 1 self.frame.fSizer.Layout() self.frame.Fit()
def __init__(self, parent): wx.Panel.__init__(self, parent) # Attributes self.il = ImageListCtrl(self) # Setup for times in range(5): data2d = build_np_img(width=5, height=3) my_bitmap = GetBitmap_from_np_array(data2d) self.il.AppendBitmap(my_bitmap) # Layout self.mid_sizer = wx.BoxSizer(wx.VERTICAL) self.mid_sizer.Add(self.il, 1, wx.EXPAND) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(wx.StaticText(self, label="Image List:"), 0) self.sizer.Add(self.mid_sizer, 1, wx.EXPAND) self.SetSizer(self.sizer)