Newbie tkinter question: Scale release event?

Elvis Chen chene at cs.queensu.ca
Mon Apr 8 21:15:59 EDT 2002


Greetings,

I'm a relative newbit to Python/tkinter, so please go easy with my
question.  I have search through google/python.org, but havn't found the
answer to my question yet:

I'm trying to do some OpenGL programming with pythong/tkinter.  I would
like to use Scale widget of tkinter to control the movement/rotation of a
camera.  That I would like to do is, upon the release of the mouse button
off a Scale widget, the value of the Scale widget is used via a callback
mechanism to update camera orientation.  After the update, the scale is
reset back to zero.

For example, I currently have:

def rotx(a):
    global rotx_scale  # a Scale widget
    angle_in = rotx_scale.get()
    ren.GetActiveCamera().Elevation( angle_in )
    rotx_scale.set( 0 )

and in the main:

    # Rotation about X-axis
    global rotx_scale
    rotx_scale = Scale( root, from_=-180, to=180, resolution=5,
                        command=rotx )

The problem of my code is, the callback function is called whenever the
mouse is "paused" on the screen.  I would like to change it so that the
callback is only called when the mouse button is released.

any help is very much appreciated,

ECC




More information about the Python-list mailing list