<html style="direction: ltr;">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="UTF-8" bgcolor="#FFFFFF"
text="#000000">
<p>Hi all,</p>
<p><br>
</p>
<p>Actually I asked for this issue in another thread but I faced a
problem can't find any solution for it, so could you please help
me to fix it?</p>
<p>When I run the following class I get "TypeError object of type
int has no len()" at for loop line 51. "messages" varialble is a
list not int value... what's the problem here?</p>
<p><br>
</p>
<p>PS</p>
<p>In the attachment you can find eric project.</p>
<p><br>
</p>
<p><br>
</p>
<p>----snippet----</p>
<pre><pre>from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
<font class="pastecode" color="#FF0000">class</font> TeSplashScreen(QFrame):
<font class="pastecode" color="#008B00">""</font>"
Splash doc
<font class="pastecode" color="#008B00">""</font>"
app = QApplication(sys.argv)
sPixmap = QPixmap(10, 10)
sMessage = QString()
# messages = [<font class="pastecode" color="#008B00">"nothing"</font>]
sAlignment = 0
sColor = QColor()
def __init__(self, pixmap):
super(QFrame, self).__init__()
self.sPixmap = pixmap
self.setWindowFlags(Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setFixedSize(self.sPixmap.size())
def clearMessage(self):
self.sMessage.clear()
self.repaint()
def showMessage(self, theMessage, theAlignment, theColor):
self.sMessage = theMessage
self.sAlignment = theAlignment
self.sColor = theColor
self.repaint()
def paintEvent(self, pe):
aTextRect = QRect(self.rect())
aTextRect.setRect(aTextRect.x()+5, aTextRect.y()+5, aTextRect.width()-10, aTextRect.height()-10)
aPainter = QPainter(self)
aPainter.drawPixmap(self.rect(), self.sPixmap)
aPainter.setPen(self.sColor)
aPainter.drawText(aTextRect, self.sAlignment, self.sMessage)
def showSplash(self, delay, messages, alignment, color):
delay = 0
# self.messages = messages
alignment = 0
color = QColor(color)
<font class="pastecode" color="#FF0000">class</font> SleeperThread(QThread):
msecs = 0
QThread.msleep(msecs)
aSplashScreen = TeSplashScreen(self.sPixmap)
aSplashScreen.show
<font class="pastecode" color="#FF0000">for</font> i in range(len(messages)):
aSplashScreen.showMessage(messages[i], alignment, color)
SleeperThread.msleep(delay)</pre></pre>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Best Regards
Muhammad Bashir Al-Noimi
My Blog: <a class="moz-txt-link-freetext" href="http://mbnoimi.net">http://mbnoimi.net</a></pre>
</body>
</html>