Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User jinxy's Avatar
    Join Date
    Oct 2007
    Posts
    3
    Hello! i want to display both text and pictures in pys60, and here's how i do it:

    def handle_redraw(rect):
    global img
    img.blit(scanp, target = (0,0), source = (0,0),scale = 0 )
    data = appuifw.Text()
    img.blit(data, target = (210,100), source = (0,0),scale = 0 )
    canvas.blit(img)

    so i try to assign to img both picture ant text and than blit it to canvas. Obvious it doesn't work. The question is: how should i do it? Thanks!

  2. #2
    Nokia Developer Moderator bogdan.galiceanu's Avatar
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471
    I don't entirely understand your approach so I won't try to see what's wrong with it, but I can give you and alternative method (though it may not be exactly what you want):

    Code:
    bgimage=Image.open("C:\\Python\\myimage.jpg")
    
    bgimage.text((210,100), u"Text goes here", font='normal')
    
    def handle_redraw(rect):canvas.blit(bgimage)
    canvas=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)
    appuifw.app.body=canvas
    List of fonts: http://wiki.forum.nokia.com/index.php/Python_Fonts
    Last edited by bogdan.galiceanu; 2008-03-14 at 14:11.

  3. #3
    Registered User neil1811's Avatar
    Join Date
    Nov 2007
    Posts
    26
    Hi bogdan,

    i display image similar to how you describe there.

    But then when my app still runs i cannot get rid of the canvas?it blocks whatever i have printing to the console.
    how would i get back to normal after displaying the image?

    Any help would be great. Thank you

    EDIT: what i mean by this is.. i will enter some details tha cause am inage to display. But i want to be able to move along with the app. But at the moment the image blocks my view of the console and i cant see anything.
    Last edited by neil1811; 2008-03-16 at 10:57.

  4. #4
    Nokia Developer Moderator bogdan.galiceanu's Avatar
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471
    Quote Originally Posted by neil1811 View Post
    Hi bogdan,

    i display image similar to how you describe there.

    But then when my app still runs i cannot get rid of the canvas?it blocks whatever i have printing to the console.
    how would i get back to normal after displaying the image?

    Any help would be great. Thank you

    EDIT: what i mean by this is.. i will enter some details tha cause am inage to display. But i want to be able to move along with the app. But at the moment the image blocks my view of the console and i cant see anything.
    Hello neil,

    I'm not entirely sure I understand your question, but from what I do understand you want to display an image and then stop displaying it and switch back to the console.

    Here's how I would do it:
    Code:
    #To show what I mean, I'll use a menu to trigger showing the image, and showing the console, respectively
    
    def show_image():
        bgimage=Image.open("C:\\Python\\myimage.jpg")
        
        def handle_redraw(rect):canvas.blit(bgimage)
        canvas=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)
        appuifw.app.body=canvas
    
    def stop_showing_image():appuifw.app.body=appuifw.Text()
        
    appuifw.app.menu=[(u"Show the image", show_image), (u"Next step", stop_showing_image)]
    I'm sorry if this is not what you are looking for, but it's the only solution I can think of.

  5. #5
    Registered User neil1811's Avatar
    Join Date
    Nov 2007
    Posts
    26
    wow, yes thats exactly what i was looking for!

    my app is starting to come along.
    Thank you for your help. and such a quick response!

  6. #6
    Registered User ComplexT's Avatar
    Join Date
    Mar 2008
    Posts
    25
    it seems i not the only one who having trouble with this part of pys60.. can anyone provide me with any information on this.

    I have my image displaying fine.. but i want to print out details about something underneath.
    so what i basically want is

    say this is my screen...
    ====================================

    ***********My Image Here**********
    ____________________________________


    Outputted text that may come from my
    DB down in this half etc


    ====================================

    so i suppose i want half a canvas half text?
    is there a way to have that image there all the time and just work with the bottom half.

    ANY HELP! Thank you in advance

  7. #7
    Registered User ComplexT's Avatar
    Join Date
    Mar 2008
    Posts
    25
    So i dont want to draw on the image i have. i want the image there as a sort of a header to all my pages.

    Hope i have explained it ok! i can add text to the photo as in example below but i need sort of independant picture and text

    thank you again

  8. #8
    Nokia Developer Moderator bogdan.galiceanu's Avatar
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471
    Quote Originally Posted by ComplexT View Post
    So i dont want to draw on the image i have. i want the image there as a sort of a header to all my pages.

    Hope i have explained it ok! i can add text to the photo as in example below but i need sort of independant picture and text

    thank you again
    I think there is a way:
    Code:
    import TopWindow, e32, appuifw
    from graphics import *
    
     
    bgimage=Image.open("C:\\Python\\myimage.jpg")
    
    window=TopWindow.TopWindow()
    
    window.add_image(bgimage, (0,0,240,120)) #These are the coordinates I used, you may use others instead
    window.size=(240, 120) #These give the size of the displayed image
    window.corner_type='square'
    window.position = (0,0)  #The "window"'s position
    
    def quit():
    	window.hide()
    	app_lock.signal()
     
    app_lock=e32.Ao_lock()
    window.show()
     
    appuifw.app.exit_key_handler=quit
    app_lock.wait()
    I hope that helps

  9. #9
    Registered User qcalv's Avatar
    Join Date
    May 2008
    Posts
    15
    Hey!
    One question with that, how is it possible to display the console of python, but to have still the menu? I cant get to do this, cause as soon as i specify a menu, i have to put a screen to "normal" or whatever, and then the console is hided? My problem is that i use the canvas to print text, so i cant use top window for that, and i want to switch between console, and canvas, and so on but keeping my menu all along?!
    cheers,

    qcalv

  10. #10
    Regular Contributor shubhendra's Avatar
    Join Date
    Dec 2007
    Location
    Tempe, AZ
    Posts
    411
    Hi qcalv,
    Seeing python console as well as menu can be done, i have tried for first time when script runs.
    IDEAS is all they need but still they think only Genius can give them that.

  11. #11
    Registered User qcalv's Avatar
    Join Date
    May 2008
    Posts
    15
    Yeah i guess its not impossible but how?

    Shall i do that?

    appuifw.app.title=u"MyTitle"
    appuifw.app.menu=[\
    (u"Quit",quit),\
    (u"Phone connection",connect()),\
    (u"Debug",debug)]

    and then it should work? What should i defined for appuifw.body?

    I forgot to give some precision, at the beginning, i create a new canvas, and use some rectangles, text etc... on it, and use the redraw callback to update this canvas, but after with the Debug function i want to come back to my initial state, where only the console and a menu coexist, and it doesnt work, for exemple the title always stays set up...

    Thanks
    Last edited by qcalv; 2008-06-25 at 09:26.

  12. #12
    Registered User qcalv's Avatar
    Join Date
    May 2008
    Posts
    15
    Ok I found out by myself, at the beginning if you print the appuifw.app.body, it gives you appuifw.Text() with some adress in the memory (where the console is saved i assume), in order to get back the console on the screen, you have to save the variable appuifw.app.body at the beginning, and then when needed restore it, i didnt find any other way to get back my console after setting up a canvas and drawing on it... hope that helps some folks!!
    have fun with python!!
    qcalv

Similar Threads

  1. Display text and picture~~~
    By yahyah_yy in forum Symbian C++
    Replies: 5
    Last Post: 2005-07-06, 01:01
  2. Weblogging pictures and text from a mobile phone
    By hotoak in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2005-02-22, 10:06
  3. Text and Pictures in CeikRichTExtEditor?
    By ayulo in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-03-29, 04:33
  4. "Encoding" pictures, text into MMS messages
    By Arturas in forum General Messaging
    Replies: 1
    Last Post: 2002-11-27, 09:35
  5. embedding pictures in text editor
    By s60 in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-06-24, 07:27

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved