[PyQt] Searching for a very small scprit using CLIPBOARD

Demetrius Cassidy dcassidy36 at mass.rr.com
Sun Apr 26 02:14:41 BST 2009


The clipboard will empty when your program exits. Afaik this is normal
behavior with Qt and clipboard access. 

I know if I use wxWindows the text in the clipboard stays even if I close my
app, however I am not sure if it's possible to do this in Qt.

And use sys.exit(app.exec_()) instead.


projetmbc wrote:
> 
> I've tried the following code but the application never stops because of 
> app.exec_(), and when I close the application, the clipboard is "empty".
> 
> =========================
> #!/usr/bin/env python
> #coding=utf-8
> import sys
> from PyQt4 import QtGui
> app = QtGui.QApplication(sys.argv)
> clipboard = app.clipboard()
> clipboard.setText('texte')
> app.exec_()
> =========================
> 
> 
> Darren Dale a écrit :
>> Have you tried constructing a QApplication first?
>>
>> On Sat, Apr 25, 2009 at 8:24 PM, projetmbc <projetmbc at club-internet.fr 
>> <mailto:projetmbc at club-internet.fr>> wrote:
>>
>>     I've already try that but I have the following message :
>>     QWidget: Must construct a QApplication before a QPaintDevice
>>
>>     Christophe.
>>
>>
>>     Demetrius Cassidy a écrit :
>>
>>         from PyQt4.QtGui import QApplication
>>
>>         clipboard = QApplication.clipboard()
>>         clipboard.setText('mytext')
>>
>>         see http://doc.trolltech.com/4.5/qapplication.html
>>          
>>
>>
>>     _______________________________________________
>>     PyQt mailing list    PyQt at riverbankcomputing.com
>>     <mailto:PyQt at riverbankcomputing.com>
>>     http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>>
> 
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 
> 

-- 
View this message in context: http://www.nabble.com/Searching-for-a-very-small-scprit-using-CLIPBOARD-tp23236437p23238177.html
Sent from the PyQt mailing list archive at Nabble.com.




More information about the PyQt mailing list