python def question
def spinBox_Changed(self, a0, b0=785, c0=300):

self.LCDNumber10.display((b0-c0)/a0)

this works great if I manually have b0 and c0 values there but I need to get these variables from a slider value and spinbox valve respectively.

The slider is self.slider5_2.value
tried lots of combos like .value display Value etc.

The spinbox is self.spinBox24.value

Any help or advice would be appreciated
Thanks
Gary

You might want to let people in on which GUI toolkit you are using.

You might want to let people in on which GUI toolkit you are using.

Gui built with qtdesigner3
Pyqt
Python 2.6.4
Gnome/Ubuntu 9.10

I have this example from somewhere on the web that changes based on the slider value. You are interested in the moveSlider and valueChanged functions. Sorry, I didn't note where i came from.

Edit: Just noticed that you are using Qt3, so try this program instead. I don't have Qt3 installed so can't test it.

"""**************************************************************************
** $Id: rangecontrols.py,v 1.1 2003/07/01 14:18:37 phil Exp $
**
** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
**
** This file is part of an example program for Qt.  This example
** program may be used, distributed and modified without limitation.
**
***************************************************************************"""

import sys
from qt import *

INT_MAX = sys.maxint

class RangeControls( QVBox ):
    def __init__( self, parent=None, name=None ):
        QVBox.__init__( self, parent, name )
        
        row1  = QHBox( self )
        cell2 = QVBox( row1 )
        cell2.setMargin( 10 )
        cell2.setFrameStyle( QFrame.WinPanel | QFrame.Sunken )

        QWidget( cell2 )

        label1 = QLabel( QString( "Enter a value between\n%1 and %2:" ).arg( -INT_MAX ).arg( INT_MAX ), cell2 )
        label1.setMaximumHeight( label1.sizeHint().height() )
        sb1 = QSpinBox( -INT_MAX, INT_MAX, 1, cell2 )
        sb1.setValue( 0 )

        label2 = QLabel( "Enter a zoom value:", cell2 )
        label2.setMaximumHeight( label2.sizeHint().height() )
        sb2 = QSpinBox( 0, 1000, 10, cell2 )
        sb2.setSuffix( " %" )
        sb2.setSpecialValueText( "Automatic" )

        label3 = QLabel( "Enter a price:", cell2 )
        label3.setMaximumHeight( label3.sizeHint().height() )
        sb3 = QSpinBox( 0, INT_MAX, 1, cell2 )
        sb3.setPrefix( "$" )
        sb3.setValue( 355 )

        QWidget( cell2 )

        row2 = QHBox( self )

        cell3 = QVBox( row2 )
        cell3.setMargin( 10 )
        cell3.setFrameStyle( QFrame.WinPanel | QFrame.Sunken )
        hslider = QSlider( 0, 64, 1, 33, Qt.Horizontal, cell3 )
        lcd2 = QLCDNumber( 2, cell3 )
        lcd2.display( 33 )
        lcd2.setSegmentStyle( QLCDNumber.Filled )
        self.connect( hslider, SIGNAL("valueChanged( int )"), lcd2, SLOT("display( int )") )

        cell4 = QHBox( row2 )
        cell4.setFrameStyle( QFrame.WinPanel | QFrame.Sunken )
        cell4.setMargin( 10 )
        vslider = QSlider( 0, 64, 1, 8, Qt.Vertical, cell4 )
        lcd3 = QLCDNumber( 3, cell4 )
        lcd3.display( 8 )
        self.connect( vslider, SIGNAL("valueChanged( int )"), lcd3, SLOT("display( int )") )

def main( args ):
    a = QApplication( args )
    
    rangecontrols = RangeControls()
    rangecontrols.resize( 500, 300 )
    rangecontrols.setCaption( "Qt Example - Range Control Widgets" );
    a.setMainWidget( rangecontrols )
    rangecontrols.show()
    
    a.exec_loop()
    
if __name__=="__main__":
    main(sys.argv)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.