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.


    Image.image nil

    Pythonista
    3
    4
    1634
    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.
    • robertiii
      robertiii last edited by

      How do I remove an image from an image view? I want the image view to remain but to remain blank with a black background

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        Have you tried setting .image=None?

        1 Reply Last reply Reply Quote 0
        • zrzka
          zrzka last edited by

          As @JonB wrote, None works. Try it ...

          from ui import *
          
          
          class MyView(View):
              def __init__(self):
                  self.width = 320
                  self.height = 320
          
                  iv = ImageView()
                  iv.background_color = '#ffff00'
                  iv.width = 50
                  iv.height = 50
                  iv.center = self.center
                  iv.image = Image('iob:folder_24')
                  self.add_subview(iv)
                  self.iv = iv
          
                  b = Button()
                  b.title = 'Remove Me'
                  b.width = 100
                  b.height = 44
                  b.center = self.center
                  b.y = self.bounds.y + 10
                  b.action = self.remove_image
                  self.add_subview(b)
          
              def remove_image(self, sender):
                  self.iv.image = None
          
          view = MyView()
          view.present('sheet')
          
          1 Reply Last reply Reply Quote 0
          • robertiii
            robertiii last edited by

            Thank you so much!!!!!!!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors