def _set_value(self, value): if self.type in (GP_WIDGET_MENU, GP_WIDGET_RADIO, GP_WIDGET_TEXT): value = ctypes.c_char_p(value) elif self.type == GP_WIDGET_RANGE: value = ctypes.c_float_p(value) # this line not tested elif self.type in (GP_WIDGET_TOGGLE, GP_WIDGET_DATE): value = PTR(ctypes.c_int(value)) else: return None # this line not tested check(gp.gp_widget_set_value(self._w, value))