Helpers
Many widgets require access to a state via a reference, which can’t be done for integers, floats and strings in Python. That’s why such helper classes as Str, Bool, Int, Float, RGB and Date exist.
- class pyegui.Str(value)
Str stores string value that can be referenced
Usage:
data = Str("") def update_func(): heading(f"Value of the data is {data.value}") if button_clicked("Add :)"): data.value += ":) "
- class pyegui.Bool(value)
Bool stores a boolean value that can be referenced
Usage:
data = Bool(False) def update_func(): heading(f"Value of the data is {data.value}") # button will be shown only if the checkbox is checked if data.value and button_clicked("set to False"): # hiding the button data.value = False checkbox(data, "Check me")
- class pyegui.Int(value)
Int stores integer value that can be referenced
Usage:
data = Int(69) def update_func(): heading(f"Value of the data is {data.value}") if button_clicked("Increment"): data.value += 1
- class pyegui.Float(value)
Float stores float value that can be referenced
Usage:
data = Float(69.0) def update_func(): heading(f"Value of the data is {data.value}") if button_clicked("Increment"): # what can go wrong? data.value += 0.1