def __init__(self, initindex, *args, **kwargs): """ Required Inputs * **initindex** index to initial toggle state * **pos** position of toggle """ kwargs.setdefault('frame', Frame(0, 0, 110, 150)) super().__init__("ggimages/toggle-up-down.png", [True, False], initindex, *args, **kwargs) self.scale = 0.4
def __init__(self, *args, **kwargs): """ Required Inputs * **pos** position of point * **value** state of the indicator (True/False or integer) """ kwargs.setdefault('frame', Frame(0,0,600,600)) kwargs.setdefault('qty', 2) super().__init__("ggimages/red-led-off-on.png", *args, **kwargs) self.scale = 0.05
def __init__(self, callback, *args, **kwargs): """ Required Inputs * **callback** reference of a function to execute, passing this button object * **pos** position of point """ kwargs.setdefault('frame', Frame(0, 0, 100, 100)) kwargs.setdefault('qty', 2) super().__init__("ggimages/button-round.png", callback, *args, **kwargs) self.scale = 0.3
def __init__(self, callback, *args, **kwargs): kwargs.setdefault("frame", Frame(0, 0, 100, 100)) kwargs.setdefault("qty", 2) super().__init__(self.getImagePath("button-round.png"), callback, *args, **kwargs) self.scale = 0.3
def __init__(self, initindex, *args, **kwargs): kwargs.setdefault("frame", Frame(0, 0, 110, 150)) super().__init__(self.getImagePath("toggle-up-down.png"), [True, False], initindex, *args, **kwargs) self.scale = 0.4
def __init__(self, *args, **kwargs): kwargs.setdefault("frame", Frame(0, 0, 600, 600)) kwargs.setdefault("qty", 2) super().__init__(self.getImagePath("red-led-off-on.png"), *args, **kwargs) self.scale = 0.05
""" Example of using the InputImageButton class. """ from ggame.inputpoint import InputImageButton from ggame.mathapp import MathApp from ggame.asset import Frame def pressbutton(_button): """ Callback function executed when button is pressed. """ print("Button Pressed!") BUTTON = InputImageButton("images/button-round.png", pressbutton, (0, 0), frame=Frame(0, 0, 100, 100), qty=2) BUTTON.scale = 0.5 MathApp().run()
""" Example of using ImageIndicator class. """ from ggame.mathapp import MathApp from ggame.indicator import ImageIndicator from ggame.inputpoint import InputImageButton from ggame.asset import Frame BUTTON = InputImageButton( "images/button-round.png", None, (40, 105), positioning="physical", frame=Frame(0, 0, 100, 100), qty=2, ) BUTTON.scale = 0.5 LIGHT = ImageIndicator( "images/red-led-off-on.png", (100, 100), BUTTON, # button object supplies the indicator state. positioning="physical", frame=Frame(0, 0, 600, 600), qty=2, ) LIGHT.scale = 0.1 MathApp().run()