[PyQt] Kled module

David Boddie david.boddie at met.no
Wed Jun 26 10:47:02 BST 2013


On Tue Jun 25 23:55:53 BST 2013, Phil wrote:

> On 25/06/13 22:34, Robert Kent wrote:
> > Hi Phil,
> >
> > I don't know about using Kled, but I have an LED widget written in pure
> > python/PyQt4 which may suit your needs. You can download it from my
> > google code page here:
> >
> > https://code.google.com/p/gulon-soft/downloads/list
> 
> Thank you Robert, Oliver and Detlev.
> 
> I'm keen to have a look at your LED project Robert and I'll see if I can 
> find the LED project suggested by Detlev.
> 
> I briefly played with PyKDE module Oliver but I couldn't relate the 
> PyKDE code with either PyQt or PySide.

Just out of interest, was the problem to do with getting PyQt and PyKDE to
work together? This example shows how PyKDE widgets, like KLed, and
PyQt widgets, like QWidget, can be mixed in an application:

  #!/usr/bin/env python

  import sys

  from PyQt4.QtGui import QVBoxLayout, QWidget
  from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
  from PyKDE4.kdeui import KApplication, KLed

  if __name__ == "__main__":

      about = KAboutData("LED", "", ki18n("LED"), "1.0", ki18n("LED example"))
      args = KCmdLineArgs.init(sys.argv, about)
      app = KApplication()

      led = KLed()
      w = QWidget()
      l = QVBoxLayout(w)
      l.addWidget(led)
      w.show()

      sys.exit(app.exec_())

Note that the KLed class appears to cause a crash when the application
exits if it hasn't been placed in another widget; in this case, we use a
QWidget.

David


More information about the PyQt mailing list