SIP4 python bindings for TQt
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tut6.py 1008B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python
  2. # TQt tutorial 6.
  3. import sys
  4. from python_tqt import qt
  5. class LCDRange(qt.TQVBox):
  6. def __init__(self, parent=None, name=None):
  7. qt.TQVBox.__init__(self, parent, name)
  8. lcd = qt.TQLCDNumber(2, self, "lcd")
  9. slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider")
  10. slider.setRange(0, 99)
  11. slider.setValue(0)
  12. self.connect(slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)"))
  13. class MyWidget(qt.TQVBox):
  14. def __init__(self, parent=None, name=None):
  15. qt.TQVBox.__init__(self, parent, name)
  16. quit = qt.TQPushButton("Quit", self, "quit")
  17. quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold))
  18. self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()"))
  19. grid = qt.TQGrid(4, self)
  20. for c in range(4):
  21. for r in range(4):
  22. LCDRange(grid)
  23. a = qt.TQApplication(sys.argv)
  24. w = MyWidget()
  25. a.setMainWidget(w)
  26. w.show()
  27. sys.exit(a.exec_loop())