button
pdwidgets.widgets.button
Button widget with optional icon and label.
Button(parent, x=0, y=0, w=None, h=None, align=None, align_to=None, fg=None, bg=None, visible=True, value=None, padding=None, radius=0, pressed_offset=2, pressed=False, label=None, text_color=None, text_height=TEXT_SIZE.LARGE, icon_file=None, icon_color=None, shadow=0)
Bases: Widget
Clickable control with optional icon and text label.
Initialize a Button widget to display an icon and/or text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Widget
|
The parent widget or screen that contains this widget. |
required |
x
|
int
|
The x-coordinate of the widget. |
0
|
y
|
int
|
The y-coordinate of the widget. |
0
|
w
|
int
|
The width of the widget. |
None
|
h
|
int
|
The height of the widget. |
None
|
align
|
int
|
The alignment of the widget. |
None
|
align_to
|
Widget
|
The widget to align to. |
None
|
fg
|
int
|
The foreground color of the widget. |
None
|
bg
|
int
|
The background color of the widget. |
None
|
visible
|
bool
|
The visibility of the widget (default is True). |
True
|
value
|
Any
|
User-assigned value of the widget. |
None
|
padding
|
tuple
|
The padding on each side of the widget. |
None
|
radius
|
int
|
The corner radius of the widget (default is 0). |
0
|
pressed_offset
|
int
|
The offset of the widget when pressed (default is 2). |
2
|
pressed
|
bool
|
The state of the widget (default is False). |
False
|
label
|
str
|
The text label of the widget. |
None
|
text_color
|
int
|
The color of the text label. |
None
|
text_height
|
int
|
The height of the text label (default is TEXT_SIZE.LARGE). |
LARGE
|
icon_file
|
str
|
The icon file to display on the widget. |
None
|
icon_color
|
int
|
The color of the icon. |
None
|
shadow
|
int
|
Fake drop-shadow offset in pixels drawn behind the
button in |
0
|
draw(_=None)
Draw the button background and shape (with an optional drop shadow).
press(data=None, event=None)
Draw pressed-state outline (mouse down handler).
release(data=None, event=None)
Restore normal outline (mouse up handler).