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.

rangecontrols.py 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/usr/bin/env python
  2. """**************************************************************************
  3. ** $Id: rangecontrols.py,v 1.1 2003/07/01 14:18:37 phil Exp $
  4. **
  5. ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
  6. **
  7. ** This file is part of an example program for TQt. This example
  8. ** program may be used, distributed and modified without limitation.
  9. **
  10. ***************************************************************************"""
  11. import sys
  12. from python_tqt.qt import *
  13. INT_MAX = sys.maxint
  14. class RangeControls( TQVBox ):
  15. def __init__( self, parent=None, name=None ):
  16. TQVBox.__init__( self, parent, name )
  17. row1 = TQHBox( self )
  18. cell2 = TQVBox( row1 )
  19. cell2.setMargin( 10 )
  20. cell2.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken )
  21. TQWidget( cell2 )
  22. label1 = TQLabel( TQString( "Enter a value between\n%1 and %2:" ).arg( -INT_MAX ).arg( INT_MAX ), cell2 )
  23. label1.setMaximumHeight( label1.sizeHint().height() )
  24. sb1 = TQSpinBox( -INT_MAX, INT_MAX, 1, cell2 )
  25. sb1.setValue( 0 )
  26. label2 = TQLabel( "Enter a zoom value:", cell2 )
  27. label2.setMaximumHeight( label2.sizeHint().height() )
  28. sb2 = TQSpinBox( 0, 1000, 10, cell2 )
  29. sb2.setSuffix( " %" )
  30. sb2.setSpecialValueText( "Automatic" )
  31. label3 = TQLabel( "Enter a price:", cell2 )
  32. label3.setMaximumHeight( label3.sizeHint().height() )
  33. sb3 = TQSpinBox( 0, INT_MAX, 1, cell2 )
  34. sb3.setPrefix( "$" )
  35. sb3.setValue( 355 )
  36. TQWidget( cell2 )
  37. row2 = TQHBox( self )
  38. cell3 = TQVBox( row2 )
  39. cell3.setMargin( 10 )
  40. cell3.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken )
  41. hslider = TQSlider( 0, 64, 1, 33, TQt.Horizontal, cell3 )
  42. lcd2 = TQLCDNumber( 2, cell3 )
  43. lcd2.display( 33 )
  44. lcd2.setSegmentStyle( TQLCDNumber.Filled )
  45. self.connect( hslider, SIGNAL("valueChanged( int )"), lcd2, SLOT("display( int )") )
  46. cell4 = TQHBox( row2 )
  47. cell4.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken )
  48. cell4.setMargin( 10 )
  49. vslider = TQSlider( 0, 64, 1, 8, TQt.Vertical, cell4 )
  50. lcd3 = TQLCDNumber( 3, cell4 )
  51. lcd3.display( 8 )
  52. self.connect( vslider, SIGNAL("valueChanged( int )"), lcd3, SLOT("display( int )") )
  53. def main( args ):
  54. a = TQApplication( args )
  55. rangecontrols = RangeControls()
  56. rangecontrols.resize( 500, 300 )
  57. rangecontrols.setCaption( "TQt Example - Range Control Widgets" );
  58. a.setMainWidget( rangecontrols )
  59. rangecontrols.show()
  60. a.exec_loop()
  61. if __name__=="__main__":
  62. main(sys.argv)