omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Show image.png as ui button background or in image view

    Pythonista
    ui.image image ui.button ui.imageview
    2
    2
    1987
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • GSpaceC
      GSpaceC last edited by

      I can’t get the image to show up. I don’t understand the documentation. Could someone post an example pls?

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @GSpaceC last edited by cvp

        @GSpaceC quick and dirty

        import ui
        
        v = ui.View()
        v.frame = (0,0,200,200)
        v.background_color = 'white'
        
        b = ui.Button()
        b.image = ui.Image.named('test:Peppers').with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
        b.frame = (10,10,100,100)
        v.add_subview(b)
        
        im = ui.ImageView()
        im.frame = (120,120,70,70)
        im.image = ui.Image.named('test:Peppers')
        v.add_subview(im)
        
        v.present('sheet')
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors