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.


    Crash when running image view code

    Pythonista
    3
    7
    2442
    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.
    • mieq
      mieq last edited by mieq

      import ui
      
      v = ui.View()
      	
      img_view = ui.ImageView(frame=(0, 0, 94.75, 94.75))
      	
      img_view.load_from_url('http://img04.sogoucdn.com/app/a/200678/c05334d63dfad90470f64f2f3e0abd91.png')
      v.add_subview(img_view)
      
      v.present('fullscreen') 
      

      Hi, Pythonista 3.3 Crash when running this code a second time (normal for the first time).any ideas?Thanks!

      cvp 2 Replies Last reply Reply Quote 1
      • cvp
        cvp @mieq last edited by

        @mieq I don't have a real crash but my Pythonista is locked.... No idea why

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

          @mieq workaround

          import ui
          import requests
          
          url = 'http://img04.sogoucdn.com/app/a/200678/c05334d63dfad90470f64f2f3e0abd91.png'
          c = requests.get(url).content
          
          v = ui.View()
          img_view = ui.ImageView(frame=(0, 0, 94.75, 94.75))
          img_view.image = ui.Image.from_data(c)
          
          v.add_subview(img_view)
          v.present('fullscreen')  
          
          mieq 1 Reply Last reply Reply Quote 1
          • mieq
            mieq @cvp last edited by

            @cvp works perfectly, so much thanks for your quick help!

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

              @mieq I suppose, but not sure, the problem comes from asynchronous dark side of load_from_url 😀

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

                @cvp It does make sense.😆

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

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors