Python Forum
[PyQt] print an image using PyQt - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [PyQt] print an image using PyQt (/thread-23498.html)



print an image using PyQt - micro - Jan-03-2020

i tried to use QtPrintSupport
it works fine with html content but image doesn't shows up
from PyQt5 import QtPrintSupport

self.editor = QTextEdit(self)
self.editor.setHtml(html_page_var)
dialog = QtPrintSupport.QPrintPreviewDialog()
dialog.paintRequested.connect(self.editor.print_)
dialog.exec_()



RE: print an image using PyQt - micro - Jan-03-2020

i need help


RE: print an image using PyQt - Denni - Jan-07-2020

Well if you supply a MRE (Minimal Reproducible Example) of you issue perhaps you can get a quicker answer. I for one have not played around with QtPrintSupport as of yet but without an MRE of you issue I am not even going to take a stab at it as there is not enough to work with. Note if you do not have an MRE that means you are not doing this in a MUC (Minimal Usable Code) which is a mistake in-and-of-itself because when trying to get something to function you need to isolate its functionality and play with it until you get it working before you bring it into the main program you are developing


RE: print an image using PyQt - micro - Jan-08-2020

well it was a silly mistake the code is working just fine
i was typing the wrong image path, silly i know


RE: print an image using PyQt - Denni - Jan-08-2020

No not really -- sometimes the most frustrating bugs are simply a typo