Toggle between the two states.
(self, e)
| 95 | ) |
| 96 | |
| 97 | def toggle_switch(self, e): |
| 98 | """Toggle between the two states.""" |
| 99 | self.value = 0 if self.value == 1 else 1 |
| 100 | self.content.controls[0] = self.get_container(self.moon_icon, self.value == 0) |
| 101 | self.content.controls[1] = self.get_container(self.sun_icon, self.value == 1) |
| 102 | self.update() |
| 103 | if self.on_switch: |
| 104 | self.on_switch(self.value) |
| 105 | |
| 106 | def get_value(self): |
| 107 | """Return the current toggle state.""" |
nothing calls this directly
no test coverage detected