[PySide] Help with resource files
Algis Kabaila
akabaila at pcug.org.au
Tue Apr 9 01:55:18 CEST 2013
Sean, thanks for letting me know that you actually used
PySideSimplicissimus to learn PySide - makes me feel that writting it was
worth while!
To reiterate, and hopefully making clearer, my earlier remarks in this
list. Python's print command prints text string objects what your program
snippet via PySide (or PyQt for that matter) returns is not a text string
object.
To make it a text object one could try to use QplainTextEdit object which
may have methods to read your "texty" object and does have a method to
"disgorge" a text (that can be printed with Python print() method).
I really did not see why one would want to use such inefficient way of
carrying text - there is much more data in the encoded format than plain
text. I think I now see why - you want to distribute your program as one
file that can be run with
python <your program name>
Is that right?
And you frown upon the possibility of running it as
python <your program name> <a blob of data to read>
Is that roughly the situation?
Al.
On Monday 08 April 2013 23:26:57 Eric Johnson wrote:
> Sean Fisk <sean <at> seanfisk.com> writes:
> > OK, I have an interim solution. While I do believe that
> > QFile.readAll() should return the file contents as a QByteArray,
> > QResource.data() seems to work!
> > Here is the code:
> I tested it at home on OS X 10.8.2 using the builtin Python and Qt
> 4.8.1, PySide 1.1.1 and it works once I opened the file with
> test_txt.open(QtCore.QIODevice.ReadOnly | QtCore.QIODevice.Text)
>
> Output is:
> Running PySide 1.1.1 / Qt 4.8.1
> PySide compiled with Qt 4.8.1
> Does it exist?: True
> readAll(): `This is just a test.
> '
>
> Is there a good reason you aren't opening the file?
>
> Eric
>
>
>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130409/05404852/attachment.html>
More information about the PySide
mailing list