summaryrefslogtreecommitdiffstats
path: root/examples3/desktop.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples3/desktop.py')
-rwxr-xr-xexamples3/desktop.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/examples3/desktop.py b/examples3/desktop.py
index 7036248..46c41dc 100755
--- a/examples3/desktop.py
+++ b/examples3/desktop.py
@@ -26,13 +26,13 @@ maxpoints = 5
maxcurves = 8
def poly():
- d = QApplication.desktop()
- d.setEraseColor(Qt.white)
+ d = TQApplication.desktop()
+ d.setEraseColor(TQt.white)
xvel = [ 0 ] * maxpoints
yvel = [ 0 ] * maxpoints
head = 0
tail = -maxcurves + 2
- a = [ QPointArray() ] * maxcurves
+ a = [ TQPointArray() ] * maxcurves
r = d.rect()
for i in range(maxcurves):
a[i].resize(maxpoints)
@@ -43,11 +43,11 @@ def poly():
xvel[i] = velocity(i)
yvel[i] = velocity(i)
- paint = QPainter()
+ paint = TQPainter()
paint.begin(d)
for ntimes in range(2000):
- paint.setBrush(QColor(kindaRand()%360,180,255, QColor.Hsv))
+ paint.setBrush(TQColor(kindaRand()%360,180,255, TQColor.Hsv))
paint.drawPolygon(a[head])
tail = tail + 1
if tail >= maxcurves:
@@ -82,31 +82,31 @@ def poly():
def rotate():
w = 64
h = 64
- image = QImage(w, h, 8, 128)
+ image = TQImage(w, h, 8, 128)
for i in range(128):
image.setColor(i, qRgb(i,0,0))
for y in range(h):
for x in range(w):
image.setPixel(x,y,(x+y)%128)
- pm = QPixmap()
+ pm = TQPixmap()
pm.convertFromImage(image)
- pm.setOptimization(QPixmap.BestOptim)
+ pm.setOptimization(TQPixmap.BestOptim)
- d = QApplication.desktop()
+ d = TQApplication.desktop()
for i in range(0,361,2):
- m = QWMatrix()
+ m = TQWMatrix()
m.rotate(i)
rpm = pm.xForm(m)
d.setErasePixmap(rpm)
d.update()
def generateStone(pm, c1, c2, c3):
- p = QPainter()
- p1 = QPen(c1, 0)
- p2 = QPen(c2, 0)
- p3 = QPen(c3, 0)
+ p = TQPainter()
+ p1 = TQPen(c1, 0)
+ p2 = TQPen(c2, 0)
+ p3 = TQPen(c3, 0)
p.begin(pm)
for i in range(pm.width()):
@@ -130,9 +130,9 @@ def drawShadeText(p, x, y, text, topColor, bottomColor, sw=2):
p.setPen(topColor)
p.drawText(x, y, text)
-class DesktopWidget(QWidget):
+class DesktopWidget(TQWidget):
def __init__(self, s, parent=None, name=''):
- QWidget.__init__(self, parent, name, Qt.WType_Desktop | Qt.WPaintDesktop)
+ TQWidget.__init__(self, parent, name, TQt.WType_Desktop | TQt.WPaintDesktop)
self.text = s
self.pm = None
@@ -141,16 +141,16 @@ class DesktopWidget(QWidget):
c2 = c1.light(104)
c3 = c1.dark(106)
if not self.pm:
- self.pm = QPixmap(64, 64)
+ self.pm = TQPixmap(64, 64)
generateStone(self.pm, c1, c2, c3)
self.setErasePixmap(self.pm)
self.update()
br = self.fontMetrics().boundingRect(self.text)
- offscreen = QPixmap(br.width(), br.height())
+ offscreen = TQPixmap(br.width(), br.height())
x = self.width()/2 - br.width()/2
y = self.height()/2 - br.height()/2
offscreen.fill(self, x, y)
- p = QPainter()
+ p = TQPainter()
p.begin(offscreen)
drawShadeText(p, -br.x(), -br.y(), self.text, c2, c3, 3)
p.end()
@@ -168,8 +168,8 @@ def desktopText(s='Trolltech'):
c2 = c1.light(104)
c3 = c1.dark(106)
- pm = QPixmap(10, 10)
- p = QPainter()
+ pm = TQPixmap(10, 10)
+ p = TQPainter()
p.begin(pm)
r = p.fontMetrics().boundingRect(s)
p.end()
@@ -189,10 +189,10 @@ def desktopText(s='Trolltech'):
qApp.desktop().setErasePixmap(pm)
-a = QApplication(sys.argv)
+a = TQApplication(sys.argv)
if len(sys.argv) > 1:
- f = QFont('charter', 96, QFont.Black)
- f.setStyleHint(QFont.Times)
+ f = TQFont('charter', 96, TQFont.Black)
+ f.setStyleHint(TQFont.Times)
a.setFont(f)
validOptions = 0