<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi all, <br>Here is an example of a working konsole kpart in PyKDE for who are looking for an example as I was yesterday! I created it using PyKHTML example provided by Jim in PyKDE examples. I don't know how I can implement a kpart as a widget in a PyQt application yet (anyone knows?), but if I find I will post it here. <br><br>from kdecore import KCmdLineArgs, KApplication, KAboutData<br>from kdeui import KStdAction<br>from kparts import KParts, createReadOnlyPart<br><br>import sys<br><br>FALSE = 0<br>TRUE = not FALSE<br><br>class konsoleMW (KParts.MainWindow):<br> def __init__ (self, *args):<br> apply (KParts.MainWindow.__init__, (self,) +
args)<br> quitAction = KStdAction.quit (self.close, self.actionCollection ())<br> self.setGeometry (0, 0, 600, 500)<br><br> <br> self.part = createReadOnlyPart ("libkonsolepart", self)<br> self.w = self.part.widget ()<br> self.w.setGeometry (30, 55, 500, 400);<br> self.w.show ();<br> def
queryExit(self):<br> #// this slot is invoked in addition when the *last* window is going<br> #// to be closed. We could do some final cleanup here.<br> return TRUE #// accept<br><br><br><br><br><br><br><br>aboutData = KAboutData ("KONSOLE", "PyKONSOLE","0.1","Konsole Part" , KAboutData.License_GPL,"(c) 2002, Jim Bublitz")<br><br>KCmdLineArgs.init (sys.argv, aboutData)<br>app = KApplication ()<br><br>if (app.isRestored()):<br> RESTORE(KLess)<br>else:<br> parts = konsoleMW (None, "pyParts")<br> if len(sys.argv) >
1:<br> args = KCmdLineArgs.parsedArgs()<br><br>parts.show()<br>app.exec_loop()<br><br></div></div><br></body></html>