def __init__(self, parent): wx.Frame.__init__(self, parent, -1, "PROYECTO BASE DE DATOS ^u^", size=(1090, 500)) Panel = wx.Panel(self) Notebook = wx.Notebook(Panel) grid = SimpleGrid(Notebook) #wx.Panel(Notebook) grid_1 = Diccionario_1(Notebook) page_1 = wx.Panel(Notebook) a = wx.StaticText(page_1, -1, "Aca sale el resultado <3") Notebook.AddPage(grid, "EMPLOYEES") Notebook.AddPage(grid_1, "DICCIONARIO") Notebook.AddPage(page_1, "RESULTADO") sizer = wx.BoxSizer() sizer.Add(Notebook, 1, wx.EXPAND) Panel.SetSizer(sizer) grid.AutoSize() grid.EnableEditing(False) grid.DisableDragGridSize() grid_1.AutoSize() grid_1.EnableEditing(False) grid_1.DisableDragGridSize() self.InitUI()
def __init__(self, parent): wx.Frame.__init__(self, parent, title='Statistics') wtl = CsvTimeLogger() statistics = wtl.get_statistics() panel = wx.Panel(self) top_sizer = wx.BoxSizer(wx.VERTICAL) grid = wx.grid.Grid(self, -1) grid.CreateGrid(len(statistics), 2) # + 1 due to summary row at end grid.SetColLabelValue(0, "Day") grid.SetColLabelValue(1, "Worked") grid.SetRowLabelSize(0) for i, (k, v) in enumerate(statistics.items()): grid.SetCellValue(i, 1, format_timedelta(v)) grid.SetCellAlignment(i, 1, wx.ALIGN_RIGHT, wx.ALIGN_CENTER) if isinstance(k, dt.date): grid.SetCellValue(i, 0, k.strftime('%a %Y-%m-%d')) grid.SetCellAlignment(i, 0, wx.ALIGN_RIGHT, wx.ALIGN_CENTER) rel_extra_time = v.total_seconds() / dt.timedelta(hours=4).seconds grid.SetCellBackgroundColour(i, 1, get_color_red_white_blue(rel_extra_time)) else: grid.SetCellValue(i, 0, k) grid.AutoSize() top_sizer.Add(grid, 0, wx.CENTER) panel.SetSizer(top_sizer) top_sizer.Fit(self) self.Show()
def viewSpreadSheet(self, spreadsheet_data, auto_size=True): """ View SpreadSheet struct in grid control. :param spreadsheet_data: SpreadSheet struct data. :param auto_size: Auto size grid control? :return: True/False. """ # log.debug(u'View SpreadSheet %s' % str(spreadsheet_data)) if self._spreadsheet_grid is None: log_func.warning( u'Not define wx.Grid control for view SpreadSheet struct') return False if wxobj_func.isWxDeadObject(self._spreadsheet_grid): log_func.warning( u'wx.Grid control for view SpreadSheet struct is dead') return False try: result = self._viewSpreadSheet(spreadsheet_data) if auto_size: grid = self.getSpreadSheetGrid() if grid: grid.AutoSize() return result except: log_func.fatal(u'Error view SpreadSheet struct in grid control') return False
def CreateGrid(slef, parent): panel = wx.Panel(parent) grid = wx.grid.Grid(panel) # 创建网格 table = MyGridTable() # 创建表格 grid.SetTable(table, True) grid.AutoSize() # 设置自动化调整行列 font1 = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, faceName='微软雅黑') font2 = wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD) grid.SetLabelFont(font1) # 标题字体 grid.SetDefaultCellFont(font2) # 单元格字体 # 设置网格行高 rowsizes = wx.grid.GridSizesInfo(30, []) grid.SetRowSizes(rowsizes) # 设置网格列宽 colsizes = wx.grid.GridSizesInfo(0, [100, 120, 50, 150, 120, 120]) grid.SetColSizes(colsizes) # 设置居中对齐 grid.SetDefaultCellAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) # 设置背景色 grid.SetDefaultCellBackgroundColour('#EEE9E9') box = wx.BoxSizer() box.Add(grid, 1, flag=wx.ALL | wx.EXPAND, border=5) panel.SetSizer(box) return panel
def bind_to_grid(self, grid): """Bind to intercept events on the grid Binds on_mouse_motion and on_column_resize in order to do tooltips. Sets up editing / auto size and other to customize for table type. """ self.grid = grid grid.AutoSize() grid.EnableEditing(False) grid.SetDefaultCellOverflow(False) if self.v.corner_button is None: grid.fn_clicked = None else: fn_clicked = self.v.corner_button["fn_clicked"] def on_corner_button_clicked(): fn_clicked() self.update_grid() grid.ForceRefresh() grid.Parent.Layout() grid.fn_clicked = on_corner_button_clicked grid.label = self.v.corner_button.get("label", "Update") grid.tooltip = self.v.corner_button.get("tooltip", "") # # Below largely taken from # http://wiki.wxpython.org/wxGrid%20ToolTips # self.last_pos = (None, None) grid.GetGridWindow().Bind(wx.EVT_MOTION, self.on_mouse_motion) grid.Bind(wx.grid.EVT_GRID_COL_SIZE, self.on_column_resize)
def CreateGrid(self, parent): grid = wx.grid.Grid(parent) tablebase = MyGridTable() grid.SetTable(tablebase, True) # 设置行和列自定调整 grid.AutoSize() return grid
def __init__(self, parent): super(MyPanel1, self).__init__(parent) #text = wx.TextCtrl(self, style = wx.TE_MULTILINE, size = (250,150)) lbl1 = wx.StaticText(self, label="Position")#, pos=(0,0) grid = SimpleGrid(self) grid.AutoSize() grid.EnableEditing(False) grid.DisableDragGridSize()
def CreateGrid(self, parent): grid = wx.grid.Grid(parent) grid.CreateGrid(len(list_jsj), len(list_jsj[0])) for row in range(len(list_jsj)): for col in range(len(list_jsj[row])): grid.SetColLabelValue(col, column_names[col]) grid.SetCellValue(row, col, list_jsj[row][col]) # 设置行和列自动调整 grid.AutoSize() return grid
def CreateGrid(self, parent): grid = wx.grid.Grid(parent) grid.CreateGrid(len(data), len(data[0])) for r in range(len(data)): for c in range(len(data[r])): grid.SetColLabelValue(c, column_names[c]) grid.SetCellValue(r, c, data[r][c]) grid.AutoSize() return grid
def CreateGrid(self, parent): grid = wx.grid.Grid(parent) grid.CreateGrid(len(data), len(data[0])) for row in range(len(data)): for col in range(len(data[row])): grid.SetColLabelValue(col, column_names[col]) grid.SetCellValue(row, col, data[row][col]) grid.AutoSize() return grid
def CreateGrid(self, parent): grid = wx.grid.Grid(parent) # grid.CreateGrid(len(data), len(data[0])) # 设置网格的行数和列数 table = MyGridTable() grid.SetTable(table, True) #for row in range(len(data)): # for col in range(len(data[row])): # grid.SetColLabelValue(col, column_names[col]) # 设置单元格标题 # grid.SetCellValue(row, col, data[row][col]) # 设置单元格内容 # 设置行和列自动调整 grid.AutoSize() return grid
def CreateGrid(self, parent): grid = wx.grid.Grid(parent) grid.CreateGrid(len(data), len(data[0])) for r in range(len(data)): for c in range(len(data[r])): grid.SetColLabelValue(c, column_names[c]) grid.SetCellValue(r, c, data[r][c]) # if r % 2 == 0: # grid.SetCellBackgroundColour(r, c, "SEA green") # else: # grid.SetCellBackgroundColour(r, c, "SLATE blue") grid.AutoSize() return grid
def CreateGrid(self, parent): grid = wx.grid.Grid(parent) grid.CreateGrid(len(data), len(data[0])) for r in range(len(data)): for c in range(len(data[r])): grid.SetColLabelValue(c, column_names[c]) grid.SetCellValue(r, c, data[r][c]) grid.SetCellAlignment(r, c, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False) grid.SetCellFont(r, c, font) if r % 2 == 0: grid.SetCellBackgroundColour(r, c, "SEA green") else: grid.SetCellBackgroundColour(r, c, "SLATE blue") grid.AutoSize() return grid
def on_btn_refresh_click(self, event): data = utils.load_file()[-10:] # Create a wxGrid object fm = wx.Frame(self, -1, title='Log Info', size=(500, 300)) grid = wx.grid.Grid(fm, -1) grid.CreateGrid(len(data), 4) grid.SetColLabelValue(0, 'ID') grid.SetColLabelValue(1, 'Data') grid.SetColLabelValue(2, 'Nome') grid.SetColLabelValue(3, 'Mensagem') for row, x in enumerate(data): for col, value in enumerate(x): grid.SetCellValue(row, col, str(value)) grid.AutoSize() grid.AutoSizeColumn(3) fm.Centre() fm.Show()
def InitializeComponents(self): grid = wx.grid.Grid(self) grid.CreateGrid(5, 2) # Set column labels. grid.SetColLabelValue(0, "Title") grid.SetColLabelValue(1, "URL") # Set cell values. grid.SetCellValue(0, 0, "Google") grid.SetCellValue(0, 1, "http://google.com/") grid.SetCellValue(1, 0, "Yahoo! JAPAN") grid.SetCellValue(1, 1, "http://www.yahoo.co.jp/") grid.SetCellValue(2, 0, "Python") grid.SetCellValue(2, 1, "http://www.python.org/") grid.SetCellValue(3, 0, "Python Documentation") grid.SetCellValue(3, 1, "http://docs.python.org/") grid.SetCellValue(4, 0, "wxPython") grid.SetCellValue(4, 1, "http://www.wxpython.org/") # Alignment. grid.AutoSize()
def CreateGrid(self, parent): # pp = wx.Panel(parent) # grid = wx.grid.Grid(pp) grid = wx.grid.Grid(parent) grid.CreateGrid(len(data), len(data[0])) grid.SetColSize(0, 70) grid.SetColSize(1, 110) grid.SetColSize(2, 70) grid.SetColSize(3, 110) grid.SetColSize(4, 110) grid.SetColSize(5, 110) grid.SetColMinimalAcceptableWidth(80) grid.SetRowMinimalAcceptableHeight(50) for r in range(len(data)): grid.SetRowSize(r, 50) for c in range(len(data[r])): # grid.SetColLabelValue(c, column_names[c]) grid.SetCellValue(r, c, str(data[r][c])) grid.SetCellAlignment(r, c, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) font = wx.Font(15, wx.SWISS, wx.NORMAL, wx.BOLD, False) grid.SetCellFont(r, c, font) grid.AutoSize() # pp.SetSizer(grid) return grid
def showSqlData(self,data,grid): table = MyDataTable(data[1],data[0]) grid.SetTable(table) grid.AutoSize() grid.Refresh()
def __init__(self, parent): wx.Frame.__init__(self, parent, -1, "A Grid", size=(275, 275)) grid = SimpleGrid(self) grid.AutoSize() grid.EnableEditing(False) grid.DisableDragGridSize()
def __init__(self, parent): super(PanelDic, self).__init__(parent) grid = Diccionario_2(self) grid.AutoSize() grid.EnableEditing(False) grid.DisableDragGridSize()