| Reply | « Previous Thread | Next Thread » |
|
Hi,
I need help debugging the following code.The background isn't being set to the image specified. Code:
from window import Application
from appuifw import *
from graphics import *
import graphics
import appuifw
image_path='e:\\logozjp8.jpg'
class MyApp(Application):
def __init__(self):
menu = [ (u"Menu A", self.option_a),
(u"Menu B", self.option_b),
(u"Menu C", self.option_c) ]
img=Image.new((240,320))
bgimage=Image.open(image_path)
canvas=Canvas(event_callback=None, redraw_callback=self.handle_redraw)
body=canvas
Application.__init__(self,
u"MyApp title",
body,
menu)
def handle_redraw(self,rect):
canvas.blit(bgimage)
def option_a(self): note(u"A","info")
def option_b(self): note(u"B","info")
def option_c(self): note(u"C","info")
def close_app(self):
ny = popup_menu( [u"No", u"Yes"], u"Exit ?")
if ny is not None:
if ny == 1:
Application.close_app(self)
if __name__ == "__main__":
app = MyApp()
app.run()
Code:
bgimge.resize((canvas.size))
Last edited by soontobeared : 2009-03-08 at 07:35.
Reason: Forgot Something
|
| soontobeared |
| View Public Profile |
| Find all posts by soontobeared |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
hello soontobeared
there are lots or mistakes in your code. so i am giving you a small function set a background image. Code:
appuifw.app.title = u"Secret Messages"
appuifw.app.screen='large'
img = graphics.Image.open(u"your path goes here")
def handle_redraw(rect):
canvas.blit(img)
canvas=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)
appuifw.app.body=canvas
img = img.resize(canvas.size)
canvas.blit(img)
![]() Enjoy Pythoning Gaba88 Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60
Last edited by gaba88 : 2009-03-08 at 08:43.
|
|
Hi Gaba,
I am still having problems merging your code with mine.Here's what I am doing Code:
from window import Application
from appuifw import *
from graphics import *
import graphics
import appuifw
image_path='e:\\logozjp8.jpg'
class MyApp(Application):
def __init__(self):
menu = [ (u"Menu A", self.option_a),
(u"Menu B", self.option_b),
(u"Menu C", self.option_c) ]
## img=Image.new((240,320))
bgimage=Image.open(image_path)
canvas=Canvas(event_callback=None, redraw_callback=self.handle_redraw)
body=canvas
bgimage.resize(canvas.size)
canvas.blit(bgimage)
Application.__init__(self,
u"MyApp title",
body,
menu)
def handle_redraw(self,rect):
canvas.blit(bgimage)
def option_a(self): note(u"A","info")
def option_b(self): note(u"B","info")
def option_c(self): note(u"C","info")
def close_app(self):
ny = popup_menu( [u"No", u"Yes"], u"Exit ?")
if ny is not None:
if ny == 1:
Application.close_app(self)
if __name__ == "__main__":
app = MyApp()
app.run()
1.The image is being displayed on the background, but not resized to fit in the mobile screen. 2.The notes that comeup upon clicking the buttons on the menu aren't disappearing after a while ie. the canvas is not being redrawn Please help me debug the code. Thanks&Regards
Last edited by soontobeared : 2009-03-09 at 02:44.
|
| soontobeared |
| View Public Profile |
| Find all posts by soontobeared |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Background image loading in listbox | RJ_Develop | General Symbian C++ | 3 | 2008-08-08 08:32 |
| view based app backgound - how to set standart theme background image ? | donDonald | Symbian User Interface | 6 | 2007-06-28 12:22 |
| How to drow image on another image (background) | afka | Mobile Java General | 1 | 2006-08-23 14:14 |
| Help~ Grid's background image ... | jpottojp | Symbian | 4 | 2005-06-17 11:56 |
| Debugging a C++ code in VC6++ IDE | mainul_2001 | Bluetooth Technology | 1 | 2002-10-02 13:34 |