[PySide] Help with resource files

Sean Fisk sean at seanfisk.com
Mon Apr 8 22:41:13 CEST 2013


That's good to know, Eric. Eventually we will be doing Windows distribution so I'm glad there are no problems. 

Here is another update. I tried putting Lena on a button using QIcon on my OS X installation and it worked:

That leads me to believe it's a problem with QFile, not the actual generated resource file. I'm going to try messing around with the QResource class next.

Thanks for all the help, guys!

Sincerely,

-- 
Sean Fisk


On Monday, April 8, 2013 at 3:18 PM, Eric Johnson wrote:

> Sean Fisk <sean <at> seanfisk.com (http://seanfisk.com)> writes:
> 
> > 
> > Thanks for the confirmation with Python 2 and 3 on Ubuntu. Although we
> > don't yet know whether it is a bug or just incorrect code by me.
> > 
> > 
> 
> 
> Works fine for me on Windows (cygwin/bash shell but win32 version of
> Python 2.7.2) if I open the file first. 
> 
> I'm surprised there is no exception thrown if you don't do this.
> I can try on OS X tonight.
> 
> ...
> # Read resource
> test_txt = QtCore.QFile(':/test.txt')
> test_txt.open(QtCore.QIODevice.ReadOnly | QtCore.QIODevice.Text)
> print 'Does it exist?: {0}'.format(test_txt.exists())
> print "readAll(): `{0}'".format(test_txt.readAll())
> 
> gives output
> 
> $ python test.py
> Running PySide 1.1.0 / Qt 4.7.4
> PySide compiled with Qt 4.7.4
> Does it exist?: True
> readAll(): `This is just a test.
> '
> 
> Eric
> 
> 
> 
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org (mailto: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/20130408/25c49ecd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resource-qicon-lena.png
Type: image/png
Size: 15393 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130408/25c49ecd/attachment.png>


More information about the PySide mailing list