Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions arcade/gui/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
from arcade.gui.nine_patch import NinePatchTexture
from arcade.gui.property import Property, bind, ListProperty
from arcade.gui.surface import Surface
from arcade.types import RGBA255
from arcade.types import RGBA255, Color

if TYPE_CHECKING:
from arcade.gui.ui_manager import UIManager

__all__ = ["Surface"]
__all__ = ["Surface", "UIDummy"]


class Rect(NamedTuple):
Expand Down Expand Up @@ -716,8 +716,14 @@ def on_click(self, event: UIOnClickEvent):

class UIDummy(UIInteractiveWidget):
"""
Solid color widget, used for testing.
Prints own rect on click.
Solid color widget used for testing & examples

It should not be subclassed for real-world usage.

When clicked, it does the following:

* Outputs its `rect` attribute to the console
* Changes its color to a random fully opaque color

:param float x: x coordinate of bottom left
:param float y: y coordinate of bottom left
Expand Down Expand Up @@ -759,7 +765,7 @@ def __init__(

def on_click(self, event: UIOnClickEvent):
print("UIDummy.rect:", self.rect)
self.color = (randint(0, 255), randint(0, 255), randint(0, 255))
self.color = Color.random(a=255)

def on_update(self, dt):
self.border_width = 2 if self.hovered else 0
Expand Down