summaryrefslogtreecommitdiffstats
path: root/examples2/desktop.py
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-29 01:11:08 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-29 01:11:08 -0600
commit8a055d66f43592c257cece2eb8cc021808062917 (patch)
treed0922f201bd5d24b62a33160d1d9baf9e89f9a70 /examples2/desktop.py
parentb388516ca2691303a076a0764fd40bf7116fe43d (diff)
downloadpytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz
pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip
Initial TQt conversion
Diffstat (limited to 'examples2/desktop.py')
-rwxr-xr-xexamples2/desktop.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/examples2/desktop.py b/examples2/desktop.py
index a1177f2..cc0c97f 100755
--- a/examples2/desktop.py
+++ b/examples2/desktop.py
@@ -25,13 +25,13 @@ maxpoints = 5
maxcurves = 8
def poly():
- d = QApplication.desktop()
+ d = TQApplication.desktop()
d.setBackgroundColor(white)
xvel = [ 0 ] * 8
yvel = [ 0 ] * 8
head = 0
tail = -maxcurves + 2
- a = QPointArray() * maxcurves
+ a = TQPointArray() * maxcurves
r = d.rect()
for i in range(maxcurves):
a[i].resize(maxpoints)
@@ -42,11 +42,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:
@@ -81,31 +81,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.optimize(1)
- 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.setBackgroundPixmap(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()):
@@ -129,9 +129,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, WType_Desktop | WPaintDesktop)
+ TQWidget.__init__(self, parent, name, WType_Desktop | WPaintDesktop)
self.text = s
self.pm = None
@@ -140,16 +140,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.setBackgroundPixmap(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()
@@ -167,8 +167,8 @@ def desktopText(s='Troll Tech'):
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()
@@ -188,10 +188,10 @@ def desktopText(s='Troll Tech'):
qApp.desktop().setBackgroundPixmap(pm)
-a = QApplication(sys.argv)
+a = TQApplication(sys.argv)
if len(sys.argv) > 1:
- f = QFont('charter', 96, QFont.Weight.Black)
- f.setStyleHint(QFont.StyleHint.Times)
+ f = TQFont('charter', 96, TQFont.Weight.Black)
+ f.setStyleHint(TQFont.StyleHint.Times)
a.setFont(f)
validOptions = 0
if len(sys.argv) == 2: