Tag Cloud

CRM 2011 (161) CRM 4.0 (144) C# (116) JScript (109) Plugin (92) Registry (90) Techpedia (77) PyS60 (68) WScript (43) Plugin Message (31) Exploit (27) ShellCode (26) FAQ (22) JavaScript (21) Killer Codes (21) Hax (18) VB 6.0 (17) Commands (16) VBScript (16) Quotes (15) Turbo C++ (13) WMI (13) Security (11) 1337 (10) Tutorials (10) Asp.Net (9) Safe Boot (9) Python (8) Interview Questions (6) video (6) Ajax (5) VC++ (5) WebService (5) Workflow (5) Bat (4) Dorks (4) Sql Server (4) Aptitude (3) Picklist (3) Tweak (3) WCF (3) regex (3) Config (2) LINQ (2) PHP (2) Shell (2) Silverlight (2) TSql (2) flowchart (2) serialize (2) ASHX (1) CRM 4.0 Videos (1) Debug (1) FetchXml (1) GAC (1) General (1) Generics (1) HttpWebRequest (1) InputParameters (1) Lookup (1) Offline Plug-ins (1) OutputParameters (1) Plug-in Constructor (1) Protocol (1) RIA (1) Sharepoint (1) Walkthrough (1) Web.config (1) design patterns (1) generic (1) iframe (1) secure config (1) unsecure config (1) url (1)

Pages

Wednesday, August 03, 2011

Canvas

#Canvas
#The application's body can be set to Canvas, which is used mainly for displaying images


import appuifw, graphics, e32

#Define the exit function
def quit():
app_lock.signal()
appuifw.app.exit_key_handler=quit

#We define a method that will place the image myimage on the canvas:
def handle_redraw(rect):
c.blit(myimage)

#We open myimage
myimage=graphics.Image.open("C:\\myimage.jpg")

#or we make a blank one, specifying its size in pixels
myimage=graphics.Image.new((240,320))
c=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)

#This sets c as a canvas which can be redrawn and can be modified if certain events (in this case key presses) occur if you make a method for that
appuifw.app.body=c
c.text((20,30), u"something", font="title")

#Here the text is displayed at the specified coordinates on the canvas, with the title font, if the 1 button is pressed
#Other font types are normal, default, dense, symbol, annotation, and legend. You can also use other formats, as is explained below

#As you've seen above, you can write text on a canvas.
#An additional way of specifying the parameters is:
c.text((2,24), u'Hello', 0x008000, font=(u'Nokia Hindi S60',48,appuifw.STYLE_BOLD))

#Here 0x008000 is the color of the text, 48 is its size and appuifw.STYLE_BOLD is its style
#The canvas can also be cleared (and optionally filled with a color)
c.clear()

#c.clear(0x008000) fills it with green
app_lock=e32.Ao_lock()

app_lock.wait()

No comments: