Hi,
I get strange behavior when I try to grab a pixmap from a widget. After one
second, when the timer times, the app flickers and all buttons are gone.
When I then open the saved image, only lines and some colors appear. Did I
miss something, or is it an PyQt anormaly ?
Thanks
-Marc
#!/usr/bin/env python
from qt import *
import sys
from client import form as Dialog
def snap():
pix = QPixmap.grabWidget(d)
pix.save(snap.bmp, BMP)
try:
x,y,w,h = sys.argv[1:5]
except ValueError:
print must be called './clientstart.py x y w h'
sys.exit(1)
x,y,w,h = int(x),int(y),int(w),int(h)
app = QApplication(sys.argv)
d = Dialog()
app.setMainWidget(d)
#d.setGeometry(x,y,w,h)
d.show()
t = QTimer()
QObject.connect(t , SIGNAL(timeout()), snap)
t.start(1000, True)
app.exec_loop()
# Form implementation generated from reading ui file 'client.ui'
#
# Created: Don Okt 17 08:56:19 2002
# by: The PyQt User Interface Compiler (pyuic)
#
# WARNING! All changes made in this file will be lost!
from qt import *
class form(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)
if name == None:
self.setName(form)
self.resize(395,474)
self.setCaption(self.trUtf8(KMail v0.0))
self.TextLabel1 = QLabel(self,TextLabel1)
self.TextLabel1.setGeometry(QRect(120,10,150,20))
self.TextLabel1.setText(self.trUtf8(My brand new KMail v0.0))
self.TextLabel2 = QLabel(self,TextLabel2)
self.TextLabel2.setGeometry(QRect(10,60,130,20))
self.TextLabel2.setText(self.trUtf8(Send Mail To))
self.LineEdit1 = QLineEdit(self,LineEdit1)
self.LineEdit1.setGeometry(QRect(130,51,251,30))
self.LineEdit1_2 = QLineEdit(self,LineEdit1_2)
self.LineEdit1_2.setGeometry(QRect(130,90,251,30))
self.TextLabel2_2 = QLabel(self,TextLabel2_2)
self.TextLabel2_2.setGeometry(QRect(10,99,100,20))
self.TextLabel2_2.setText(self.trUtf8(Subject))
self.LineEdit3 = QLineEdit(self,LineEdit3)
self.LineEdit3.setGeometry(QRect(10,180,371,240))
self.CheckBox1 = QCheckBox(self,CheckBox1)
self.CheckBox1.setGeometry(QRect(10,140,70,31))
self.CheckBox1.setText(self.trUtf8(Encrypt))
self.CheckBox1_2_2 = QCheckBox(self,CheckBox1_2_2)
self.CheckBox1_2_2.setGeometry(QRect(170,140,80,31))
self.CheckBox1_2_2.setText(self.trUtf8(format c:))
self.CheckBox1_2 = QCheckBox(self,CheckBox1_2)
self.CheckBox1_2.setGeometry(QRect(90,140,70,31))
self.CheckBox1_2.setText(self.trUtf8(Dance))
self.CheckBox1_2_3 = QCheckBox(self,CheckBox1_2_3)
self.CheckBox1_2_3.setGeometry(QRect(250,140,130,31))
self.CheckBox1_2_3.setText(self.trUtf8(punch the monkey))
self.PushButton4 = QPushButton(self,PushButton4)
self.PushButton4.setGeometry(QRect(10,430,101,31))
self.PushButton4.setText(self.trUtf8(Send))
self.PushButton4_2 = QPushButton(self,PushButton4_2)
self.PushButton4_2.setGeometry(QRect(120,430,101,31))
self.PushButton4_2.setText(self.trUtf8(Do Send))
self.PushButton4_2_2 = QPushButton(self,PushButton4_2_2)
self.PushButton4_2_2.setGeometry(QRect(230,430,150,31))
self.PushButton4_2_2.setText(self.trUtf8(Really Send))