Python
  Home arrow Python arrow Page 2 - Mobile Programming using PyS60: Advanced UI Controls
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Mobile Programming using PyS60: Advanced UI Controls
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2008-12-29


    Table of Contents:
  • Mobile Programming using PyS60: Advanced UI Controls
  • Text
  • PyS60 in Real World
  • Reprocessing the Result

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Mobile Programming using PyS60: Advanced UI Controls - Text
    ( Page 2 of 4 )


    Text provides text editor with almost all of the text formatting functionalities. The control is provided by Text type. Unlike selection or multi-selection lists, text is a type. The functionalities provided by the text type are categorized as either attributes or methods. More precisely, since the text is a type, the functionalities are exposed either as a attribute or a method. 

    The most commonly used attributes of Text include the following:  

    • color: Defines the color of the text. The valid values are all the colors supported by graphic models in graphics module. 
    • font: Determines the font family of the text. It can be set using the supported Unicode name.
    • style: Affects the style of the text. The valid values for this attribute are defined as flags. The valid flags are provided by appuifw module. Some of the commonly used flags are:
      • STYLE_BOLD – Makes the text bold.
      • STYLE_UNDERLINE – Underlines a displayed text.
      • STYLE_ITALIC – Makes the text italic.


    For example, to use a Text type with LatinPlain12 as the font value with bold text, the statements would be:


    t = appuifw.Text()

    t.font = u"LatinPlain12" # sets font to Latin Plain 12

    t.style = appuifw.STYLE_BOLD


    As mentioned above, the Text type provides various methods to perform common operations on the text held by the editor. The most common methods are:

    • add() : Accepts a Unicode string as an argument. This method appends a text to the existing text. It can also be used to insert the passed argument at current cursor position. 
    • set() : Just like the add() method, it accepts a Unicode string as an argument. Specifically, it sets the passed Unicode string as an argument. It replaces any text that may be present in the editor. 
    • delete() : Accepts two arguments, position and length, and deletes characters in the editor for the given length, editor starting from the position passed as argument.

     

    For example, to set a string having the value “This is a text” as the text in the editor, the statement is


    t.set(u”This is a text”)


    This brings us to the end of this section. In the next section, the guessing game application that was developed in the previous article (linked to at the beginning of this one) will be enhanced using a single selection list.



     
     
    >>> More Python Articles          >>> More By A.P.Rajshekhar
     

       

    PYTHON ARTICLES

    - Tuples and Other Python Object Types
    - The Dictionary Python Object Type
    - String and List Python Object Types
    - Introducing Python Object Types
    - Mobile Programming using PyS60: Advanced UI ...
    - Nested Functions in Python
    - Python Parameters, Functions and Arguments
    - Python Statements and Functions
    - Statements and Iterators in Python
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT