Changeset 225

Show
Ignore:
Timestamp:
05/25/08 00:12:56 (8 months ago)
Author:
tal
Message:
Allow attributes to be set in the text.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • packages/vanilla/trunk/Lib/vanilla/vanillaTextBox.py

    r206 r225  
    4141        | Mini    | H | 11          | 
    4242 
    43         *text* The text to be displayed in the text box. 
     43        *text* The text to be displayed in the text box. If the object is a NSAttributedString, the attributes will be used for display. 
    4444 
    4545        *alignment* A string representing the desired visual alignment of the text in the text box. The options are: 
     
    6161        self._setupView(self.nsTextFieldClass, posSize) 
    6262        self._setSizeStyle(sizeStyle) 
    63         self._nsObject.setStringValue_(text) 
     63        if isinstance(text, NSAttributedString): 
     64            self._nsObject.setAttributedStringValue_(text) 
     65        else: 
     66            self._nsObject.setStringValue_(text) 
    6467        self._nsObject.setDrawsBackground_(False) 
    6568        self._nsObject.setBezeled_(False) 
     
    8689        *value* A string representing the contents of the text box. 
    8790        """ 
    88         self._nsObject.setStringValue_(value) 
     91        if isinstance(value, NSAttributedString): 
     92            self._nsObject.setAttributedStringValue_(value) 
     93        else: 
     94            self._nsObject.setStringValue_(value)