0
我開始看Python和QT的一些教程(https://www.youtube.com/watch?v=Eq7__6y0jwo&index=3&list=PL19DCiIwVefyQxlDTWlXQ4lnZDPW6_r-q),但我得到這個錯誤「QPainter :: begin:繪製設備返回的引擎== 0,輸入:0「,我不知道爲什麼。這個想法是,我想有一個窗口可以在3dsMax,Modo中使用,也可以作爲獨立的(3dsMax和Modo都帶有PySide)。QPainter :: begin:繪製設備返回的引擎== 0,類型:0
任何想法?
下面是代碼:
from PySide import QtCore, QtGui
import sys
class PaletteListModel (QtCore.QAbstractListModel):
def __init__(self, colors=[], parent=None):
QtCore.QAbstractListModel.__init__(self, parent)
self._colors = colors
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
listView = QtGui.QListView()
listView.show()
red = QtGui.QColor(255, 0, 0)
green = QtGui.QColor(0, 255, 0)
blue = QtGui.QColor(0, 0, 255)
model = PaletteListModel([red, green, blue])
listView.setModel(model)
sys.exit(app.exec_())
感謝,
尼克
謝謝Aaron!那對我來說太愚蠢了。這解決了它。在教程中他沒有在他的第一次運行中實現這兩種方法,所以我認爲在進一步測試之前也可以進行測試。 – Nick
沒問題,如果你的問題解決了,請接受答案:) –
gotcha!第一天堆棧溢出太多..我試圖在今天早上進行投票,但我沒有被允許,因爲我沒有足夠的聲望點。再次感謝:) – Nick