Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Archived:Using Text with appuifw2 module in PySymbian

From Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

This code snippet shows how to use the PySymbian appuifw2 extension module to enhance text display.

Article Metadata
Tested with
Devices(s): Nokia N96, Nokia N95-8GB
Platform(s): S60 3rd Edition
Platform Security
Signing Required: Self-Signed
Capabilities: None
Keywords: appuifw2
Created: ck.umraliya (05 Jan 2009)
Last edited: hamishwillee (31 May 2013)

Set application body

The appuifw2 Text instance can be created by following lines.

## import module
import appuifw2
## String
t=u"Enter Your Text Here..."
## text object
txt= appuifw2.Text(text=t, scrollbar= True, t9= True)
## Set text to application body = txt

Now lets see various methods to access this text.

  • Insert Text at a given position
txt.insert(pos=5, text="hi")
  • Geting currntly selected text
a = txt.get_selection()
print a

It will reurn a tuple of 3 values such as ( current position, last position, text)

  • We can apply various text effects. First write the wanted effects and then apply them. = appuifw2.STYLE_BOLD = appuifw2.STYLE_ITALIC = appuifw2.STYLE_UNDERLINE = appuifw2.HIGHLIGHT_STANDARD = appuifw2.HIGHLIGHT_ROUNDED = appuifw2.HIGHLIGHT_SHADOW
txt.apply(pos, length)
  • To Convert given cursor position in terms of screen pixel co-ordinates
b = txt.pos2xy(pos)
print b
  • The current cursor position in terms of screen pixel co-ordinates can be obtained by
  • Convert screen co-ordinates into cursor position
c = txt.xy2pos(co-ord)
print c

co-ord is the tuple of screen co-ordinates

  • Set limit over number of characters entered
This page was last modified on 31 May 2013, at 01:10.
31 page views in the last 30 days.