TextField

The Textfield is a Control subclass that represents Cocoa’s NSTextField.

class TextField(parent[, text])
Parameters:
text

A string that represents the text field’s text. Equivalent to [self stringValue].

placeholder

A string representing the “placeholder text”, that is, a text displayed in light shade of grey when the text field contains no text. Equivalent to [[self cell] placeholderString].

textColor

Color. Color of the text within the field. Equivalent to [self textColor].

usesSingleLineMode

Boolean. Whether the text field is allowed to have more than one line. Same as “Uses Single Line Mode” in XCode’s IB.

Label

The Label is a TextField subclass that mimics the presentation of the label in XCode, that is, uneditable, unselectable, borderless and backgroundless.

class Label(parent, text)
Parameters:

SearchField

A subclass of TextField that wraps NSSearchField. Note the slightly different initialization signature: instead of text, the second argument is placeholder because it’s very rare that we initalize a search field with text. We usually do so with a placeholder string.

class SearchField(parent, placeholder)
Parameters:
sendsWholeSearchString

Boolean. Whether the search action is triggered after each keystroke or when the user presses return. In Cocoa: cell.sendsWholeSearchString.

searchesImmediately

Boolean. Whether there’s a small delay between the keystroke and the search field action triggering. In Cocoa: cell.sendsSearchStringImmediately.

Combobox

The Combobox is a TextField subclass that represents Cocoa’s NSComboBox.

class Combobox(parent[, items=None])
Parameters:
items

A list of strings determining the items that will be present in the combobox’s dropdown.

autoCompletes

A boolean telling whether the combobox autocompletes. Equivalent to [self completes].

Table Of Contents

Previous topic

Button

Next topic

TextView

This Page