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.


    Help with ImageView

    Pythonista
    5
    8
    3569
    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.
    • Sparky
      Sparky last edited by

      I am new to pythonista. I am trying to draw an image on ui. Can someone take a look at this program and help me.
      Thanks

      coding: utf-8

      import ui
      from scene import *
      import Image,ImageDraw,sys
      import ui

      v=ui.load_view("imageviewtest")

      image1= Image.new("RGBA", (512, 512), "#000")

      draw = ImageDraw.Draw(image1, image1.mode)

      draw.rectangle([(1,1),(100,100)],outline=10,fill=10)

      del draw

      image1.show()

      Name=load_pil_image(image1)

      im=ui.Image()

      v["image"].load_from_url(Name)

      if ui.get_screen_size()[1] >= 768:

      	v.present('popover')
      

      else:
      v.present(orientations=['portrait'])

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

        see https://omz-forums.appspot.com/pythonista/post/5520750224080896

        use the pil2ui function, and set the image view image attribute to the output of that function

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

          btw, formatting code for the forums requires

          [ a blank line ]
          ```  (three backticks... long tap the single quote on iOS)
          [your code]
          ```
          
          1 Reply Last reply Reply Quote 0
          • Phuket2
            Phuket2 last edited by

            Testing...I thought you need the word python after the 3 ticks, will test below.

            # no python after the 3 ticks
            import ui
            
            If __name__ == '__main__':
                pass:
            
            #with python after the 3 ticks
            import ui
            
            If __name__ == '__main__':
                pass:
            
            
            1 Reply Last reply Reply Quote 0
            • Phuket2
              Phuket2 last edited by

              Ok, both work, but python syntax coloring when python is used

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

                :-) An amazing number of languages are supported by GitHub flavored markdown.

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

                  Lol, watching, f1, forum, programming and drinking all the same time :)

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

                    Drinking coffee in the "States" and watching forum. Happy Fathers day to those who are, and to those who have one.

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