| 3 | import wx.lib.agw.aui as aui |
| 4 | |
| 5 | class TablePanel ( wx.Panel ): |
| 6 | def __init__( self, parent): |
| 7 | wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 819,488 ), style = wx.TAB_TRAVERSAL ) |
| 8 | self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) ) |
| 9 | WTableManager.add(self) |
| 10 | |
| 11 | bSizer = wx.BoxSizer( wx.VERTICAL ) |
| 12 | |
| 13 | self.lab_info = wx.StaticText( self, wx.ID_ANY, 'MyLabel asdfasfa ', wx.DefaultPosition, wx.DefaultSize, 0 ) |
| 14 | self.lab_info.Wrap( -1 ) |
| 15 | bSizer.Add( self.lab_info, 0, wx.ALL|wx.EXPAND, 0 ) |
| 16 | self.grid = GridBase( self) |
| 17 | self.grid.set_handler(self.set_info) |
| 18 | bSizer.Add( self.grid, 1, wx.ALL|wx.EXPAND, 0 ) |
| 19 | |
| 20 | |
| 21 | self.SetSizer( bSizer ) |
| 22 | self.Layout() |
| 23 | |
| 24 | self.handle = None |
| 25 | |
| 26 | def set_handler(self, handle=None): |
| 27 | self.handle = handle |
| 28 | |
| 29 | def set_tps(self, tps): |
| 30 | self.tps = tps |
| 31 | self.grid.set_tps(tps) |
| 32 | |
| 33 | def __del__( self ): |
| 34 | print('Table Panel Del') |
| 35 | |
| 36 | def set_info(self, tps): |
| 37 | self.lab_info.SetLabel('%sx%s; %.2fK'%(tps.data.shape+(tps.get_nbytes()/1024.0,))) |
| 38 | if not self.handle is None: self.handle(tps) |
| 39 | |
| 40 | def on_test(self, event): |
| 41 | print(self.grid.GetSelectedCols(), self.grid.GetSelectedRows()) |
| 42 | print(self.grid.GetSelectionBlockTopLeft(), self.grid.GetSelectionBlockBottomRight()) |
| 43 | |
| 44 | class TableFrame(wx.Frame): |
| 45 | """CanvasFrame: derived from the wx.core.Frame""" |