[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyKDE] Setting the clipboard content without creating any window
From: Serge Weinstock <sweinst () ukonline ! co ! uk>
Date: 2006-07-04 5:27:53
Message-ID: 44A9FC59.6020108 () ukonline ! co ! uk
[Download RAW message or body]
Hi,
I'm currently writing a script which should allow me to set up the
content of the clipboard.
For this, I shouldn't need to create a window, so my first try was;
import sys
from qt import *
theApp = QApplication(sys.argv)
cb = theApp.clipboard()
print "before:", cb.text(QClipboard.Clipboard)
cb.setText("hello", QClipboard.Clipboard)
print "after:", cb.text(QClipboard.Clipboard)
The output was:
before: theApp
after: hello
But the clipboard was left unchanged...
Reading the QClipboard documentation, I found "Lastly, the X11
clipboard is event driven, i.e. the clipboard will not function properly
if the event loop is not running"
So I tried the following:
import sys
from qt import *
theApp = QApplication(sys.argv)
while theApp.hasPendingEvents():
theApp.processEvents()
##
cb = theApp.clipboard()
print "before:", cb.text(QClipboard.Clipboard)
Hi,
I'm currently writing a script which should allow me to set up the
content of the clipboard.
For this, I shouldn't need to create a window, so my first try was;
import sys
from qt import *
theApp = QApplication(sys.argv)
cb = theApp.clipboard()
print "before:", cb.text(QClipboard.Clipboard)
cb.setText("hello", QClipboard.Clipboard)
print "after:", cb.text(QClipboard.Clipboard)
The output was:
before: theApp
after: hello
But the clipboard was left unchanged...
Reading the QClipboard documentation, I found "Lastly, the X11
clipboard is event driven, i.e. the clipboard will not function properly
if the event loop is not running"
So I tried the following:
import sys
from qt import *
theApp = QApplication(sys.argv)
while theApp.hasPendingEvents():
theApp.processEvents()
##
cb = theApp.clipboard()
print "before:", cb.text(QClipboard.Clipboard)
cb.setText("hello", QClipboard.Clipboard)
print "after:", cb.text(QClipboard.Clipboard)
##
while theApp.hasPendingEvents():
theApp.processEvents()
But still the same results....
Any idea on what I do wrong?
Thanks in advance,
Serge Weinstock
cb.setText("hello", QClipboard.Clipboard)
print "after:", cb.text(QClipboard.Clipboard)
##
while theApp.hasPendingEvents():
theApp.processEvents()
But still the same results....
Any idea on what I did wrong?
Thanks in advance,
Serge Weinstock
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic