You Are Here:

Community: Developer Discussion Boards

#1 Old Simple app problem - 2007-11-28, 17:28

Join Date: Nov 2007
Posts: 4
schmrz
Offline
Registered User
Code:
import key_codes, appuifw, e32, graphics

POINT_SIZE = 10
POINT_COLOR = (0, 0, 255) #Plava
MOVE = 1

def handle_redraw(rect):
    global Loc_X, Loc_Y
    Loc_X = 10
    Loc_Y = 10
    panel.clear((0,0,0))
    panel.point((Loc_X, Loc_Y), width=POINT_SIZE, fill=POINT_COLOR)

    canvas.blit(panel)

def handle_events(event):
    if event['keycode'] == key_codes.EKeyLeftArrow:
        Loc_X = Loc_X - MOVE
        lock.signal()
    elif event['keycode'] == key_codes.EKeyRightArrow:
        Loc_X = Loc_X + MOVE
        lock.signal()
    elif event['keycode'] == key_codes.EKeyUpArrow:
        Loc_Y = Loc_Y - MOVE
        lock.signal()
    elif event['keycode'] == key_codes.EKeyDownArrow:
        Loc_Y = Loc_Y + MOVE
        lock.signal()
    elif event['keycode'] == key_codes.EKeySelect:
        quit()
        
def quit():
    running = 0
    lock.signal()
    
running = 1
appuifw.app.exit_key_handler = quit
appuifw.app.screen = 'large'

canvas = appuifw.Canvas(redraw_callback = handle_redraw, event_callback = handle_events)
W,H = canvas.size
panel = graphics.Image.new((W, H))
appuifw.app.body = canvas

lock = e32.Ao_lock()

while running:
    handle_redraw((W, H))
    lock.wait()


print Loc_X + ' ' + Loc_Y
I just get black screen ( panel.clear((0,0,0)) ) and then the application freezes...Why?
Last edited by schmrz : 2007-11-29 at 00:34.
Reply With Quote

#2 Old Re: Simple app problem - 2007-11-28, 19:41

Join Date: Nov 2007
Posts: 4
schmrz
Offline
Registered User
can anyone see the problem??
Reply With Quote

#3 Old Re: Simple app problem - 2007-11-29, 00:32

Join Date: Nov 2007
Posts: 4
schmrz
Offline
Registered User
i can't believe that there is no one that can help me...
Reply With Quote

#4 Old Re: Simple app problem - 2007-11-30, 20:21

Join Date: Nov 2007
Posts: 4
schmrz
Offline
Registered User
77 views no answer... is it that hard??
Reply With Quote

#5 Old Re: Simple app problem - 2007-12-01, 19:18

Join Date: Feb 2006
Posts: 168
Location: Helsinki, Finland
RICH?
Offline
Regular Contributor
I tried to get your code working but couldn't after correcting it a bit it still didn't work and gave no errors .So I decided to rewrite it completely:
Code:
import key_codes, e32, graphics
from appuifw import *

point_size=10
point_color=(0,0,255)
move=1

loc_x=10
loc_y=10

def handle_redraw(rect=None):
  panel.clear(0)
  panel.point((loc_x,loc_y),point_color,width=point_size)
  canvas.blit(panel)


def handle_event(event):
  global loc_x,loc_y,move
  if event['keycode'] == key_codes.EKeyLeftArrow:
    loc_x = loc_x - move
  elif event['keycode'] == key_codes.EKeyRightArrow:
    loc_x = loc_x + move
  elif event['keycode'] == key_codes.EKeyUpArrow:
    loc_y = loc_y - move
  elif event['keycode'] == key_codes.EKeyDownArrow:
    loc_y = loc_y + move
  elif event['keycode'] == key_codes.EKeySelect:
    exit()
  handle_redraw()


def exit():
  lock.signal()

running=1
app.screen='large'
app.exit_key_handler=exit

canvas=Canvas(redraw_callback=handle_redraw,event_callback=handle_event)
w,h=canvas.size
panel=graphics.Image.new((w,h))
app.body=canvas

lock = e32.Ao_lock()
lock.wait()
Now it works fine on my 6680 and should work on all other devices too


Nokia E66
PyS60 1.4.4 final
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple problem about S60 3rd Aspen General Symbian C++ 9 2007-04-13 11:52
symbian signed testing problem. anglina General Symbian C++ 0 2007-02-01 11:15
Problem with starting .exe from app tripiri General Symbian C++ 5 2005-01-09 17:36
CIMD2 receiving app problem surfacing General Messaging 0 2004-10-29 04:29
7210 & 7250 RMS resetting problem keithmcneill Mobile Java General 1 2003-11-13 22:04

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia