Home    Features    Download    Screenshots    Manual    Reference    Forums    License    Contact   
 
  Panda3D Manual: DirectSlider
  <<prev top next>>     

Use a DirectSlider to make a slider, a widget that allows the user to select a value between a bounded interval. DirectSlider is available beginning in Panda3D 1.1.

A DirectSlider consists of a long bar, by default horizontal, along with a "thumb", which is a special button that the user may move left or right along the bar. The normal DirectGui parameters such as frameSize, geom, and relief control the look of the bar; to control the look of the thumb, prefix each of these parameters with the prefix "thumb_", e.g. thumb_frameSize.

If you want to get (or modify) the current value of the slider (by default, the range is between 0 and 1), use mySlider['value'].

KeywordDefinitionValue
valueInitial value of the sliderDefault is 0
rangeThe (min, max) range of the sliderDefault is (0, 1)
pageSizeThe amount to jump the slider when the user clicks left or right of the thumbDefault is 0.1
orientationThe orientation of the sliderHORIZONTAL or VERTICAL
commandFunction called when the value of the slider changes (takes no arguments)Function
extraArgsExtra arguments to the function specified in command[Extra Arguments]
thumb_geom, thumb_relief, thumb_text, thumb_frameSize, etc.Parameters to control the look of the thumbAny parameters appropriate to DirectButton

Example

import direct.directbase.DirectStart
from direct.gui.DirectGui import *

def showValue():
        print slider['value']

slider=DirectSlider(range=(0,100), value=50, pageSize=3, command=showValue)

run()

"range" sets values between 0 and 100 "value" sets initial value to 50 "pageSize" sets the step between mouseclicks to 3 (approximately) "command" calls the showValue-function implemented above

  <<prev top next>>     
.
screenshot
Disney's Pirates of the Caribbean Online
screenshot
Code3D is a tool for creating virtual training scenarios.
screenshot
Improvisational acting techniques are used to improve character behavior