×
Namespaces

Variants
Actions

Archived:Using TopWindow 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.

Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition
Article
Keywords: topwindow
Created: Jan Rune Johansen (16 Aug 2007)
Last edited: hamishwillee (31 May 2013)

Contents

Overview

This snippet shows how to use TopWindow class from the topwindow module to show a window on top of other applications in Python.

Preconditions

Display sizes may vary from one device to another. Available sizes can be found by using the display_pixels() function of the sysinfo module.

Source code

import appuifw, e32, graphics, topwindow
 
 
app_lock = e32.Ao_lock()
#Define the exit function
def quit():
#Hide the window
window.hide()
app_lock.signal()
appuifw.app.exit_key_handler = quit
 
#Create an instance of TopWindow
window = topwindow.TopWindow()
#Set its size
window.size = (210, 160)
#Set the position of it upper left corner
window.position = (10, 40)
 
#Create a new, red image to display
img = graphics.Image.new((195, 110))
img.clear(0xFF0000)
#Write text on it
img.text((25, 25), u"This is a pop-up", font = 'title')
#Add it to the window specifying coordinates for its upper left corner
window.add_image(img, (10, 10))
#Make the window's background green
window.background_color = 0x00FF00
#Add a shadow effect
window.shadow = 4
#Make the corners round
window.corner_type = 'corner5'
 
#Display the window
window.show()
 
#Wait for the user to request the exit
app_lock.wait()

Postconditions

A pop-up window containing the specified image and other elements is shown on top of the application that is currently in the foreground.

TopWindow.jpg

Additional information

A TopWindow object also has the visible attribute which can be read in order to determine whether the object is visible, or written (1 for visible, 0 for invisible).

This page was last modified on 31 May 2013, at 04:10.
68 page views in the last 30 days.
×