本文整理匯總了Python中MOSES.getPiggyBankKeys方法的典型用法代碼示例。如果您正苦於以下問題:Python MOSES.getPiggyBankKeys方法的具體用法?Python MOSES.getPiggyBankKeys怎麽用?Python MOSES.getPiggyBankKeys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MOSES
的用法示例。
在下文中一共展示了MOSES.getPiggyBankKeys方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getPiggyBankKeys [as 別名]
def __init__(self):
super(PiggyBank, self).__init__()
self.setStyleSheet("gridline-color: rgb(0, 0, 0)")
header_labels = MOSES.getPiggyBankKeys()
self.setColumnCount(len(header_labels))
self.setHorizontalHeaderLabels(header_labels)
self.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.verticalHeader().setStretchLastSection(False)
self.verticalHeader().setVisible(True)
self.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.horizontalHeader().setStretchLastSection(True)
self.horizontalHeader().setVisible(True)
示例2: displayData
# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getPiggyBankKeys [as 別名]
def displayData(self):
#print "Displaying piggybank data!"
self.setSortingEnabled(False)
self.setRowCount(0)
row_index = 0
header_labels = MOSES.getPiggyBankKeys()
self.setColumnCount(len(header_labels))
for row in self.data_list:
#print "Printing:"
#print row
#print type(row)
#print "Row %d" % row_index #debug
if len(row) > 0:
column_index = 0
self.insertRow(row_index)
#get the keys from the PiggyBank Key list.
for key in header_labels: #each row is a dictionary.
cell_item = QtGui.QTableWidgetItem(str(row[key]))
text_color = QtGui.QColor(0, 0, 0)
if self.targets_data[row_index] == 0:
cell_color = QtGui.QColor(255, 0, 0, 250) #Transparent red.
elif self.targets_data[row_index] == -1:
cell_color = QtGui.QColor(0, 0, 0, 10)
text_color = QtGui.QColor(255, 0, 0)
else:
cell_color = QtGui.QColor(255, 255, 255, 0) #invisible white.
cell_item.setBackgroundColor(cell_color)
cell_item.setTextColor(text_color)
self.setItem(row_index,column_index,cell_item)
column_index += 1
row_index += 1
self.resizeColumnsToContents()
self.resizeRowsToContents()
self.setHorizontalHeaderLabels(header_labels)
self.setSortingEnabled(True)
self.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.verticalHeader().setStretchLastSection(False)
self.verticalHeader().setVisible(True)
self.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
self.horizontalHeader().setStretchLastSection(True)
self.horizontalHeader().setVisible(True)