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

Inheritance diagram of PGSliderBar

__init__(name: str)
property active bool

Returns whether the PGItem is currently active for mouse events. See set_active().

Getter

Returns whether the PGItem is currently active for mouse events. See set_active().

Setter

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 by set_state(), but it does affect whether it responds to mouse events.

property adjust_prefix string

Returns the prefix that is used to define the adjust event for all PGSliderBars. The adjust event is the concatenation of this string followed by get_id().

property axis LVector3
Getter

Returns the axis of the slider bar’s motion. See set_axis().

Setter

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.

property button_down bool

Returns true if the user is currently holding down the mouse button to manipulate the slider. When true, calls to set_ratio() or set_value() will have no effect.

clear_left_button()

Removes the left button object from control of the frame. It is your responsibility to actually remove or hide the button itself.

clear_right_button()

Removes the right button object from control of the frame. It is your responsibility to actually remove or hide the button itself.

clear_thumb_button()

Removes the thumb button object from control of the frame. It is your responsibility to actually remove or hide the button itself.

get_adjust_event() str

Returns the event name that will be thrown when the slider bar value is adjusted by the user or programmatically.

static get_adjust_prefix() 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 by get_id().

get_axis() LVector3

Returns the axis of the slider bar’s motion. See set_axis().

static get_class_type() TypeHandle
get_left_button() PGButton

Returns the PGButton that serves as the left scroll button for this slider, if any, or NULL if it is not set.

get_manage_pieces() bool

Returns the manage_pieces flag. See set_manage_pieces().

get_max_value() float

Returns the value when the slider is all the way to the right.

get_min_value() float

Returns the value when the slider is all the way to the left.

get_page_size() float

Returns the value last set by set_page_size().

get_ratio() float

Returns the current value of the slider, expressed in the range 0 .. 1.

get_resize_thumb() bool

Returns the resize_thumb flag. See set_resize_thumb().

get_right_button() PGButton

Returns the PGButton that serves as the right scroll button for this slider, if any, or NULL if it is not set.

get_scroll_size() float

Returns the value last set by set_scroll_size().

get_thumb_button() PGButton

Returns the PGButton that serves as the thumb for this slider, or NULL if it is not set.

get_value() float

Returns the current value of the slider.

is_button_down() bool

Returns true if the user is currently holding down the mouse button to manipulate the slider. When true, calls to set_ratio() or set_value() will have no effect.

property left_button PGButton
Getter

Returns the PGButton that serves as the left scroll button for this slider, if any, or NULL if it is not set.

Setter

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.

property manage_pieces bool
Getter

Returns the manage_pieces flag. See set_manage_pieces().

Setter

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.

property page_size float
Getter

Returns the value last set by set_page_size().

Setter

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.

property ratio float

Returns/Sets the current value of the slider, expressed in the range 0 .. 1.

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.

property resize_thumb bool
Getter

Returns the resize_thumb flag. See set_resize_thumb().

Setter

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.

property right_button PGButton
Getter

Returns the PGButton that serves as the right scroll button for this slider, if any, or NULL if it is not set.

Setter

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.

property scroll_size float
Getter

Returns the value last set by set_scroll_size().

Setter

Specifies the amount the slider will move when the user clicks on the left or right buttons.

set_active(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 by set_state(), but it does affect whether it responds to mouse events.

set_axis(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.

set_left_button(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.

set_manage_pieces(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.

set_page_size(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.

set_range(min_value: float, max_value: float)

Sets the minimum and maxmimum value for the slider.

set_ratio(ratio: float)

Sets the current value of the slider, expressed in the range 0 .. 1.

set_resize_thumb(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.

set_right_button(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.

set_scroll_size(scroll_size: float)

Specifies the amount the slider will move when the user clicks on the left or right buttons.

set_thumb_button(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.

set_value(value: float)

Sets the current value of the slider programmatically. This should range between get_min_value() and get_max_value().

setup_scroll_bar(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).

setup_slider(vertical: bool, length: float, width: float, bevel: float)

Creates PGSliderBar that represents a slider that the user can use to control an analog quantity.

This is functionally the same as a scroll bar, but it has a distinctive look.

property thumb_button PGButton
Getter

Returns the PGButton that serves as the thumb for this slider, or NULL if it is not set.

Setter

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.

property value float
Getter

Returns the current value of the slider.

Setter

Sets the current value of the slider programmatically. This should range between get_min_value() and get_max_value().