peng3d.gui.button - Button Widgets

class peng3d.gui.button.Button(name, submenu, window, peng, pos=None, size=[100, 24], bg=None, border=[4, 4], borderstyle='flat', label='Button')[source]

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 and material, 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.

label

Property for accessing the label of this Button.

redraw_label()[source]

Re-draws the label by calculating its position.

Currently, the label will always be centered on the Button.

class peng3d.gui.button.ButtonBackground(widget, border=[4, 4], borderstyle='flat')[source]

Background for the Button Widget.

This background renders the button and its border, but not the label.

class peng3d.gui.button.ImageButton(name, submenu, window, peng, pos=None, size=[100, 24], bg=None, label='Button', bg_idle=[-1, -1, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], bg_hover=None, bg_disabled=None, bg_pressed=None)[source]

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.

class peng3d.gui.button.ImageBackground(widget, bg_idle=[-1, -1, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], bg_hover=None, bg_disabled=None, bg_pressed=None)[source]

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.

class peng3d.gui.button.FramedImageButton(name, submenu, window, peng, pos=None, size=[100, 24], bg=None, label='Button', bg_idle=[-1, -1, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], bg_hover=None, bg_disabled=None, bg_pressed=None, frame_size=[[2, 10, 2], [2, 10, 2]])[source]

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.

class peng3d.gui.button.FramedImageBackground(widget, bg_idle=[-1, -1, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], bg_hover=None, bg_disabled=None, bg_pressed=None, frame_size=[[2, 10, 2], [2, 10, 2]])[source]

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.

class peng3d.gui.button.ToggleButton(name, submenu, window, peng, pos=None, size=[100, 24], bg=None, border=[4, 4], borderstyle='flat', label='Button')[source]

Variant of Button that stays pressed until clicked again.

This widgets adds the following actions:

  • press_down is called upon depressing the button
  • press_up is called upon releasing the button
  • click is changed to be called on every click on the button, e.g. like press_down and press_up combined
class peng3d.gui.button.Checkbox(name, submenu, window, peng, pos=None, size=[100, 24], bg=None, borderstyle='flat', label='Checkbox', checkcolor=[240, 119, 70])[source]

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.

redraw_label()[source]

Re-calculates the position of the Label.

class peng3d.gui.button.CheckboxBackground(widget, borderstyle, checkcolor=[240, 119, 70])[source]

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.