×
Namespaces

Variants
Actions

Archived:Using Text with appuifw2 module in PySymbian

From Nokia Developer 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
Compatibility
Platform(s): S60 3rd Edition
Platform Security
Signing Required: Self-Signed
Capabilities: None
Article
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
appuifw2.app.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.
txt.style = appuifw2.STYLE_BOLD
txt.style = appuifw2.STYLE_ITALIC
txt.style = appuifw2.STYLE_UNDERLINE
txt.style = appuifw2.HIGHLIGHT_STANDARD
txt.style = appuifw2.HIGHLIGHT_ROUNDED
txt.style = 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
txt.pos2xy(cur_pos)
  • 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
txt.set_limit(limiting_intiger_value)
This page was last modified on 31 May 2013, at 04:10.
44 page views in the last 30 days.
×