[PyQt] images in PyQt QTextEdit widgets
hpj at urpla.net
Thu Jun 11 13:28:54 BST 2009
Am Donnerstag, 11. Juni 2009 schrieb Greg Smith:
> Hey everyone, I am having a bit of a problem when trying to display a
> jpg thumbnail image in a QTextEdit widget. I have a function that builds
> an html string that has includes the image as well as some properties
> regarding the image sequence that the thumbnail represents. Once the
> string has been created I use the setHtml() method to set the string as
> the contents of the QTextEdit. When I run my tool, I get all the text
> information, but a broken image icon is displayed instead.
> The part that mystifies me is that the html string I created is based
> off of what worked in the Qt Designer when I made the ui, once I got a
> stand in to look right I simply copied the source html and used it as
> the foundation of my method.
> The image or images in question are located on our file server which is
> accessed in a typical UNC fashion, OS is WinXp x64.
> The example source code that worked looked a bit like
> so:"/////bright1/shows/stu... ../myImage.jpg". Which I tried in my
> code, but no workie. I've tried "//bright1/shows....",
> "file://///bright1/shows..", even "/bright1/shows....", but it seams
> that no matter what I try the image won't show. So I am kind puzzled to
> why I can get a picture to work in Designer, but when I try to get it to
> work at runtime of my tool. It doesn't.
How about starting with trying to access your image with QFile or QImage.
Once, you get that part working, the rest will be easy.
More information about the PyQt