def __init__(self, form, text=u'button', frame=True, center=True, var=None): """ desc: Constructor. arguments: form: desc: The parent form. type: form keywords: text: desc: Button text. type: [str, unicode] frame: desc: Indicates whether a frame should be drawn around the widget. type: bool center: desc: Indicates whether the text should be centered. type: bool var: desc: The name of the experimental variable that should be used to log the widget status. type: [str, unicode, NoneType] """ label.__init__(self, form, text, frame=frame, center=center) self.type = u'button' self.var = var self.set_var(False)
def __init__(self, form, text=u'', frame=True, center=False, stub=u'Type here ...', return_accepts=False, var=None): """ desc: Constructor. arguments: form: desc: The parent form. type: form keywords: text: desc: The text to start with. type: [str, unicode] frame: desc: Indicates whether a frame should be drawn around the widget. type: bool center: desc: Indicates whether the text should be centered. type: bool stub: desc: A text string that should be shown whenever the user has not entered any text. type: [str, unicode] return_accepts: desc: Indicates whether a return press should accept and close the form. type: bool var: desc: The name of the experimental variable that should be used to log the widget status. type: [str, unicode, NoneType] """ if type(return_accepts) != bool: return_accepts = return_accepts == u'yes' label.__init__(self, form, text, frame=frame, center=center) self.type = u'text_input' self.stub = safe_decode(stub) self.prompt = u'_' self.return_accepts = return_accepts self.var = var self.text = safe_decode(text) self.set_var(text) self.caret_pos = None