peng3d.gui.button
- Button Widgets¶
Button Widget allowing the user to trigger specific actions.
By default, this Widget uses
ButtonBackground
as its Background class.The border given is in pixels from the left/right and top/bottom, respectively.
The borderstyle may be either
flat
, which has no border at all,gradient
, which fades from the inner color to the background color,oldshadow
, which uses a simple fake shadow with the light from the top-left corner andmaterial
, which imitates Google Material Design shadows.Also, the label of the button may only be a single line of text, anything else may produce undocumented behavior.
If necessary, the font size of the Label may be changed via the global Constant
LABEL_FONT_SIZE
, changes will only apply to Buttons created after change. The text color used is[62,67,73,255]
in RGBA and the font used is Arial, which should be available on most systems.Property for accessing the label of this Button.
Re-draws the label by calculating its position.
Currently, the label will always be centered on the Button.
Background for the
Button
Widget.This background renders the button and its border, but not the label.
Subclass of
Button
using an image as a background instead.By default, this Widget uses
ImageBackground
as its Background class.There are no changes to any other mechanics of the Button, only visually.
Background for the
ImageButton
Widget.This background renders a image given based on whether the widget is pressed, hovered over or disabled.
It should also be possible to use this class as a background for most other Widgets.
Subclass of
ImageButton
adding smart scaling to the background.By default, this Widget uses
FramedImageBackground
as its Background class.Note that this feature is currently not working properly, and will thus output a warning on the console if tried to use.
Background for the
FramedImageButton
Widget.This background is similar to
ImageBackground
, but it attempts to scale smarter with less artifacts.Note that this feature is currently not working properly, and will thus output a warning on the console if tried to use.
Variant of
Button
that stays pressed until clicked again.This widgets adds the following actions:
press_down
is called upon depressing the buttonpress_up
is called upon releasing the buttonclick
is changed to be called on every click on the button, e.g. likepress_down
andpress_up
combined
Variant of
ToggleButton
using a different visual indicator.By default, this Widget uses
CheckboxBackground
as its Background class.Note that the position and size given are for the indicator, the label will be bigger than the given size.
The label given will be displayed to the right of the Checkbox.
Re-calculates the position of the Label.
Background for the
Checkbox
Widget.This background looks like a button, but adds a square in the middle if it is pressed.
The color of the square defaults to a tone of orange commonly found in GTK GUIs on Ubuntu.