TextEditor

class vanilla.TextEditor(posSize, text='', callback=None, readOnly=False, checksSpelling=False)

Standard long text entry control.:

from vanilla import *

class TextEditorDemo(object):

    def __init__(self):
        self.w = Window((200, 200))
        self.w.textEditor = TextEditor((10, 10, -10, 22),
                            callback=self.textEditorCallback)
        self.w.open()

    def textEditorCallback(self, sender):
        print "text entry!", sender.get()

TextEditorDemo()

posSize Tuple of form (left, top, width, height) representing the position and size of the text entry control.

text The text to be displayed in the text entry control.

callback The method to be called when the user presses the text entry control.

readOnly Boolean representing if the text can be edited or not.

checksSpelling Boolean representing if spelling should be automatically checked or not.

getNSScrollView()

Return the NSScrollView that this object wraps.

getNSTextView()

Return the NSTextView that this object wraps.

get()

Get the contents of the text entry control.

set(value)

Set the contents of the text box.

value A string representing the contents of the text box.

selectAll()

Select all text in the text entry control.

enable(onOff)

Enable or disable the object. onOff should be a boolean.

getPosSize()

The position and size of the object as a tuple of form (left, top, width, height).

isVisible()

Return a bool indicting if the object is visible or not.

move(x, y)

Move the object by x units and y units.

resize(width, height)

Change the size of the object to width and height.

setPosSize(posSize)

Set the postion and size of the object.

posSize A tuple of form (left, top, width, height).

show(onOff)

Show or hide the object.

onOff A boolean value representing if the object should be shown or not.