×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    209

    How to place several pictures on the screen?

    I want to place several pictures on the screen.But I only find some examples how to place one picture on the screen...
    Could I place several pictures on one canvas by the following codes?Or would someone tell me how to do?
    ...
    backup_image.clear(bgcolor)
    backup_image.blit(loaded_image0,source=sourcerect0,target=targetrect0,scale=1)
    backup_image.blit(loaded_image1,source=sourcerect1,target=targetrect1,scale=1)
    canvas.blit(backup_image)
    ...

  2. #2
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Kuopio, Finland
    Posts
    50

    Re: How to place several pictures on the screen?

    Quote Originally Posted by luckyapplehead View Post
    I want to place several pictures on the screen.But I only find some examples how to place one picture on the screen...
    Could I place several pictures on one canvas by the following codes?Or would someone tell me how to do?
    ...
    backup_image.clear(bgcolor)
    backup_image.blit(loaded_image0,source=sourcerect0,target=targetrect0,scale=1)
    backup_image.blit(loaded_image1,source=sourcerect1,target=targetrect1,scale=1)
    canvas.blit(backup_image)
    ...

    Would this demo help you?

    Code:
    #ILeImageDemo.py
    #by ilpo lehtola  savonia fi
    #PyS60 version 1.4.4 or above
    
    import appuifw, e32, graphics, sys
      
    #debug prints to file
    #sys.stdout = open('e:\\python\\debug.txt', 'w')
    #sys.stderr = open('e:\\python\\error.txt', 'w')
    
    blue = (0,0,255) 
    red = (255,0,0) 
    black = (0,0,0)
    yellow = (255,255,0)
    
    def make_img1():
    	img1.clear(blue)
    	img1.text((5,h/2),u'Im. 1',fill = black, font =('normal',40))
    
    def make_img2():
    	img2.clear(red)
    	img2.text((5,h/2),u'Im. 2',fill = yellow, font =('normal',40))
    
    def redraw(arg):
    	if img1:
    		canvas.blit(img1)
    		canvas.blit(img2, target=(w/2,0))
    
    def quit():  
    	sys.exit() #Quit to system (not to Python)   
    
    appuifw.app.exit_key_handler = quit
    
    img1 = None  
    canvas = appuifw.Canvas(redraw_callback = redraw)     
      
    appuifw.app.body = canvas   
    appuifw.app.screen = 'large'  
    appuifw.app.exit_key_handler = quit   
    
    w, h = canvas.size   
    img1 = graphics.Image.new((w/2, h))
    img2 = graphics.Image.new((w/2, h))
    	
    make_img1()
    make_img2()
    redraw(None)
       
    app_lock = e32.Ao_lock()   
    app_lock.wait()

  3. #3
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    209

    Re: How to place several pictures on the screen?

    Quote Originally Posted by ilpo55 View Post
    Would this demo help you?

    Code:
    #ILeImageDemo.py
    #by ilpo lehtola  savonia fi
    #PyS60 version 1.4.4 or above
    
    import appuifw, e32, graphics, sys
      
    #debug prints to file
    #sys.stdout = open('e:\\python\\debug.txt', 'w')
    #sys.stderr = open('e:\\python\\error.txt', 'w')
    
    blue = (0,0,255) 
    red = (255,0,0) 
    black = (0,0,0)
    yellow = (255,255,0)
    
    def make_img1():
    	img1.clear(blue)
    	img1.text((5,h/2),u'Im. 1',fill = black, font =('normal',40))
    
    def make_img2():
    	img2.clear(red)
    	img2.text((5,h/2),u'Im. 2',fill = yellow, font =('normal',40))
    
    def redraw(arg):
    	if img1:
    		canvas.blit(img1)
    		canvas.blit(img2, target=(w/2,0))
    
    def quit():  
    	sys.exit() #Quit to system (not to Python)   
    
    appuifw.app.exit_key_handler = quit
    
    img1 = None  
    canvas = appuifw.Canvas(redraw_callback = redraw)     
      
    appuifw.app.body = canvas   
    appuifw.app.screen = 'large'  
    appuifw.app.exit_key_handler = quit   
    
    w, h = canvas.size   
    img1 = graphics.Image.new((w/2, h))
    img2 = graphics.Image.new((w/2, h))
    	
    make_img1()
    make_img2()
    redraw(None)
       
    app_lock = e32.Ao_lock()   
    app_lock.wait()

    Thanks!
    I think it's helpful

  4. #4
    Registered User
    Join Date
    Apr 2012
    Posts
    6

    Re: How to place several pictures on the screen?

    Hi...The above code works fine for displaying images one next to other...
    I need to display the images one below the other...how do i do this..???
    Do i have to find out my phone's screen resolution so that the images fit in one below the other...??? if so how do i find the screen resolution using python...?

    Please do revert back


    Regards
    Ashwini

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: How to place several pictures on the screen?

    You should really try understanding how the snippet works. I do not know Python, but canvas.size pretty much seems to get the resolution, and w/2 is the calculation used for halving the screen. Now for placement below each other you may want to try using h/2 as the second size and coordinate.

Similar Threads

  1. Custom window in ALL screen modes
    By PawelDefee in forum Symbian
    Replies: 11
    Last Post: 2009-02-11, 09:19
  2. Problem with E90 and secondary screen
    By Tatanka.nbr1 in forum Symbian
    Replies: 5
    Last Post: 2008-06-27, 10:01
  3. Place of a ChoiceGroup on a screen
    By amace in forum Mobile Java General
    Replies: 0
    Last Post: 2005-06-14, 08:35
  4. UI: Full Screen Mode
    By GENERAL_INFO in forum Symbian User Interface
    Replies: 3
    Last Post: 2004-11-22, 06:27
  5. can i place my name in the front screen of my 8290?
    By GeeNigga in forum Mobile Java General
    Replies: 0
    Last Post: 2002-05-26, 18:11

Posting Permissions

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