Подскажите как изменить тип ячейки, например на список? Пробовал, но не получается. Что-то не правильно делаю, но что?
import wx
import wx.grid as gridlib
### -- ---
class TableUl(gridlib.PyGridTableBase):
def __init__(self):
gridlib.PyGridTableBase.__init__(self)
# self.colLabels = ['ID','kfdfkdjgk','flkdlfdl','dlsdfldflk','ldsdflkdfl']
self.dataTypes = {
(1,1) : gridlib.GRID_VALUE_NUMBER,
(2,2) : gridlib.GRID_VALUE_STRING,
(3.3) : gridlib.GRID_VALUE_CHOICE + ':1,43434,jdhjsdfh, хохо',
(4,4) : gridlib.GRID_VALUE_BOOL
}
self.data = {
(1,1) : "efekfrjf",
(2,2) : "kfdjfkgjfkgj",
(3,3) : "fldkj",
(4,4) : "fdfdlkfl"
}
def GetNumberRows(self):
return 150
def GetNumberCols(self):
return 50
def IsEmptyCell(self,row,col):
return self.data.get((row,col)) is not None
def GetValue(self,row,col):
value = self.data.get((row,col))
if value is not None:
return value
else:
return ''
def SetValue(self,row,col,value):
self.data[(row,col)] = value
def AppendRows(self, numRows=1):
return (self.GetRowCount() + numRows)
def AppendCols(self, numCols=1):
return (self.GetColCount() + numCols)
# def GetColLabelValue(self,col):
# return self.colLabels[col]
# def GetRowLabelValue(self,row):
# return self.rowLabels[row]
def CanGetValueAs(self,row,col,typeName):
colType = self.dataTypes[row,col].split(':')[1]
if typeName == colType:
return True
else:
return False
def CanSetValueAs(self,row,col,typeName):
return self.CanGetValueAs(row,col,typeName)
class myUl(gridlib.Grid):
def __init__(self,parent):
gridlib.Grid.__init__(self, parent, -1)
table = TableUl()
self.SetTable(table, True)