PGSliderBar
from panda3d.core import PGSliderBar
- class PGSliderBar
Bases:
Bases:
PGItem
,PGButtonNotify
This is a particular kind of
PGItem
that draws a little bar with a slider that moves from left to right indicating a value between the ranges.This is used as an implementation for both DirectSlider and for DirectScrollBar.
Inheritance diagram
- clearLeftButton()
Removes the left button object from control of the frame. It is your responsibility to actually remove or hide the button itself.
- clearRightButton()
Removes the right button object from control of the frame. It is your responsibility to actually remove or hide the button itself.
- clearThumbButton()
Removes the thumb button object from control of the frame. It is your responsibility to actually remove or hide the button itself.
- getAdjustEvent() str
Returns the event name that will be thrown when the slider bar value is adjusted by the user or programmatically.
- static getAdjustPrefix() str
Returns the prefix that is used to define the adjust event for all
PGSliderBars
. The adjust event is the concatenation of this string followed bygetId()
.
- static getClassType() TypeHandle
- getLeftButton() PGButton
Returns the
PGButton
that serves as the left scroll button for this slider, if any, or NULL if it is not set.
- getManagePieces() bool
Returns the manage_pieces flag. See
setManagePieces()
.
- getPageSize() float
Returns the value last set by
setPageSize()
.
- getResizeThumb() bool
Returns the resize_thumb flag. See
setResizeThumb()
.
- getRightButton() PGButton
Returns the
PGButton
that serves as the right scroll button for this slider, if any, or NULL if it is not set.
- getScrollSize() float
Returns the value last set by
setScrollSize()
.
- getThumbButton() PGButton
Returns the
PGButton
that serves as the thumb for this slider, or NULL if it is not set.
- isButtonDown() bool
Returns true if the user is currently holding down the mouse button to manipulate the slider. When true, calls to
setRatio()
orsetValue()
will have no effect.
- recompute()
Recomputes the position and size of the thumb. Normally this should not need to be called directly.
- remanage()
Manages the position and size of the scroll bars and the thumb. Normally this should not need to be called directly.
- setActive(active: bool)
Sets whether the
PGItem
is active for mouse watching. This is not necessarily related to the active/inactive appearance of the item, which is controlled bysetState()
, but it does affect whether it responds to mouse events.
- setAxis(axis: LVector3)
Specifies the axis of the slider bar’s motion. This should be only one of four vectors: (1, 0, 0), (0, 0, 1), (-1, 0, 0), or (0, 0, -1).
This specifies the vector in which the thumb moves when it is moving from the minimum to the maximum value.
The axis must be parallel to one of the screen axes, and it must be normalized. Hence, it may only be one of the above four possibilities; anything else is an error and will result in indeterminate behavior.
Normally, you should not try to set the axis directly.
- setLeftButton(left_button: PGButton)
Sets the
PGButton
object that will serve as the left scroll button for this slider. This button is optional; if present, the user can click on it to move scroll_size units at a time to the left.It is the responsibility of the caller to ensure that the button object is parented to the
PGSliderBar
node.
- setManagePieces(manage_pieces: bool)
Sets the manage_pieces flag. When this is true, the sub-pieces of the slider bar–that is, the thumb, and the left and right scroll buttons–are automatically positioned and/or resized when the slider bar’s overall frame is changed.
- setPageSize(page_size: float)
Specifies the amount of data contained in a single page. This indicates how much the thumb will jump when the trough is directly clicked; and if resize_thumb is true, it also controls the visible size of the thumb button.
- setResizeThumb(resize_thumb: bool)
Sets the resize_thumb flag. When this is true, the thumb button’s frame will be adjusted so that its width visually represents the page size. When this is false, the thumb button will be left alone.
- setRightButton(right_button: PGButton)
Sets the
PGButton
object that will serve as the right scroll button for this slider. This button is optional; if present, the user can click on it to move scroll_size units at a time to the right.It is the responsibility of the caller to ensure that the button object is parented to the
PGSliderBar
node.
- setScrollSize(scroll_size: float)
Specifies the amount the slider will move when the user clicks on the left or right buttons.
- setThumbButton(thumb_button: PGButton)
Sets the
PGButton
object that will serve as the thumb for this slider. This button visually represents the position of the slider, and can be dragged left and right by the user.It is the responsibility of the caller to ensure that the button object is parented to the
PGSliderBar
node.
- setValue(value: float)
Sets the current value of the slider programmatically. This should range between
getMinValue()
andgetMaxValue()
.
- setupScrollBar(vertical: bool, length: float, width: float, bevel: float)
Creates
PGSliderBar
that represents a vertical or horizontal scroll bar (if vertical is true or false, respectively), with additional buttons for scrolling, and a range of 0 .. 1.length here is the measurement along the scroll bar, and width is the measurement across the scroll bar, whether it is vertical or horizontal (so for a horizontal scroll bar, the length is actually the x dimension, and the width is the y dimension).