[PyQt] Printing in PyQt

primalcharlie charlie.hardy at outlook.com
Mon Feb 23 09:35:13 GMT 2015


Thanks man!

Regards
Charles Hardy

> On 22 Feb 2015, at 23:44, michael h [via Python] <ml-node+s6n5087165h4 at n6.nabble.com> wrote:
> 
>> 
>> Hi michael that solved that one now im getting a error saying that
>> QPainter::begin: A paint device can only be painted by one painter at a
>> time.
> 
> 
> From the docs:
> 
> QPainter::QPainter(QPaintDevice * device)
> Constructs a painter that begins painting the paint device immediately.
> 
> >         painter=QtGui.QPainter(printer)
> 
> So you're calling begin again here.
> 
> >         painter.begin(printer)
> 
> So take your own begin() call out.
> 
> As a side note, QPainter can actually be used as a context manager so you could do:
> 
> with QPainter(printer) as painter:
>      code with painter
> 
> and it will handle being()/end() for you as needed
> 
>  mh 
> 
> _______________________________________________ 
> PyQt mailing list    [hidden email] 
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://python.6.x6.nabble.com/Printing-in-PyQt-tp5086981p5087165.html
> To unsubscribe from Printing in PyQt, click here.
> NAML




--
View this message in context: http://python.6.x6.nabble.com/Printing-in-PyQt-tp5086981p5087186.html
Sent from the PyQt mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150223/c4790eb0/attachment.html>


More information about the PyQt mailing list