[PyKDE] KHTML and so on...

Carlo Truijllo truijllo at supereva.it
Wed Apr 13 11:58:31 BST 2005

Thanks a lot, my example was only extracted the code, just to show main flow.

> There are a few problems with your program.
> 1. You don't have an event loop running  - you need to call
> KApplication.exec_loop ()  (or a.exec_loop () in your example) before you
> call browser.paint. That means you'll need some kind of event (button, menu
> entry, timer) to trigger the paint event. "exec_loop" in PyQt corresponds
> to "exec" in Qt - the name change is to avoid a conflict with the Python
> "exec" keyword.
> 2. KHTMLPart is descended from KPart, so instead of KMainWindow you need to
> use KPart.MainWindow.  You'll probably need a .rc file too.
> For (1) and (2) you can look at PyKDE/examples/pyKHTMLPart.py for an
> example of how to set up the main window and event loop and the .rc file.
> You can use pyKHTMLPart.py as a starting point - you'll need to add code to
> start printing.

I'll do soon ;)

> 3. Setting up a KPrinter/QPrinter to print is a little more involved than
> what your code shows. See, for example, the way printing is done in
> PyQt/examples3/application.py, and the Qt and KDE docs. KPrinter should
> function about the same way QPrinter does. You can get your app working
> with QPrinter first, and then switch to KPrinter. I've always found
> QPrinter/KPrinter a little tricky to set up and get working, so locating
> the docs is a good idea in this case.

I've already configured a simple app capable to print something from a kedit
object, my trouble is print html rendered, I should manage like simple text
( scrolling lines ) or like pics ?
Thanks a lot !


More information about the PyQt mailing list