File tree Expand file tree Collapse file tree 5 files changed +25
-2
lines changed Expand file tree Collapse file tree 5 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,11 @@ class ButtonBase(Group):
4040 :param y: The y position of the button.
4141 :param width: The width of the button in tiles.
4242 :param height: The height of the button in tiles.
43+ :param name: A name, or miscellaneous string that is stored on the button.
4344 :param label: The text that appears inside the button. Defaults to not displaying the label.
4445 :param label_font: The button label font.
4546 :param label_color: The color of the button label text. Defaults to 0x0.
47+ :param selected_label: Text that appears when selected
4648 """
4749
4850 def __init__ (
Original file line number Diff line number Diff line change @@ -32,11 +32,14 @@ class SpriteButton(ButtonBase):
3232 :param y: The y position of the button.
3333 :param width: The width of the button in tiles.
3434 :param height: The height of the button in tiles.
35+ :param name: A name, or miscellaneous string that is stored on the button.
3536 :param label: The text that appears inside the button. Defaults to not displaying the label.
3637 :param label_font: The button label font.
3738 :param label_color: The color of the button label text. Defaults to 0x0.
39+ :param selected_label: Text that appears when selected
3840 :param string bmp_path: The path of the 3x3 spritesheet Bitmap file
3941 :param string selected_bmp_path: The path of the 3x3 spritesheet Bitmap file to use when pressed
42+ :param int or tuple transparent_index: Index(s) that will be made transparent on the Palette
4043 """
4144
4245 def __init__ (
@@ -82,7 +85,6 @@ def __init__(
8285 elif isinstance (transparent_index , int ):
8386 self ._selected_bmp_palette .make_transparent (0 )
8487
85- print ((width // (self ._bmp .width // 3 ), height // (self ._bmp .height // 3 )))
8688 self ._btn_tilegrid = inflate_tilegrid (
8789 bmp_obj = self ._bmp ,
8890 bmp_palette = self ._bmp_palette ,
@@ -94,7 +96,6 @@ def __init__(
9496 )
9597 self .append (self ._btn_tilegrid )
9698
97- print ("setting label" )
9899 self .label = label
99100
100101 @property
Original file line number Diff line number Diff line change 66
77 .. automodule :: adafruit_button
88 :members:
9+
10+ .. automodule :: adafruit_button.button_base
11+ :members:
12+
13+ .. automodule :: adafruit_button.button
14+ :members:
15+
16+ .. automodule :: adafruit_button.sprite_button
17+ :members:
Original file line number Diff line number Diff line change @@ -33,3 +33,12 @@ A soundboard made with buttons
3333.. literalinclude :: ../examples/display_button_soundboard.py
3434 :caption: examples/display_button_soundboard.py
3535 :linenos:
36+
37+ Sprite Button
38+ -------------
39+
40+ Custom sprite button
41+
42+ .. literalinclude :: ../examples/display_button_spritebutton_simpletest.py
43+ :caption: examples/display_button_spritebutton_simpletest.py
44+ :linenos:
Original file line number Diff line number Diff line change 11# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
22#
33# SPDX-License-Identifier: Unlicense
4+
5+ adafruit-circuitpython-ImageLoad
You can’t perform that action at this time.
0 commit comments