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.


    ctypes really usable?

    Pythonista
    2
    3
    2724
    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.
    • PKHG222
      PKHG222 last edited by

      Grr forgotten to include code in this forum, so sorry

      I got from github a file for sounds ...
      starting with : from ctypes import c_void_p, c_char_p and some more ...

      My pythonista contains wel eg. numpy (new sinds?) but not ctypes ..

      So either say, no not yet, otherwise how to get it inluded ;-)

      Please,

      I saw, that so much has been done with Pythonista

      My last problem was to set a date onto a number of images ..
      using this

      import photos as ph
      from PIL import Image as im
      n = ph.get_count()
      print 'size is',n
      #aanname datum photo is laatste!!!
      todolijst = [el for el in range(n-5, n-1)]
      print todolijst
      def doimg(n):
              img = ph.get_image(n)
              return img
      i15 = doimg(todolijst[-4])
      print i15.size
      #import Sketch
      #print (ph.get_count())
      nrim = ph.get_count()
      dateImg = ph.get_image(-1) #laatste moet het date plaatje zijn met Sketch te maken
      dimgsize = dateImg.size
      print 'imgsiz',dimgsize
      i15 = i15.resize(dimgsize)
      print i15.size
      res = im.blend(i15,dateImg,0.2)
      res.show()
      ph.save_image(res)
      '''
      import photos as ph
      from PIL import Image as im
      m_plaatjes =  4 #ij changeME
      #Aanname: laatste plaatje bevat datum van Sketch gemaakt
      #Daarvoor m_plaatjes om met datum te blenden!
      n = ph.get_count()
      print 'size is',n
      
      #todolijst = [el for el in range(n-5, n-1)]
      
      #print todolijst
      
      def getImg(nr):
                    img = ph.get_image(nr)
                    return img
      #i15 = doimg(todolijst[-4])
      def blendAllImageMetDatum(m_plaatjes,n):
          dateImg = getImg(n-1)
          dimgsize = dateImg.size
          welke = n - 2
          for i in range(m_plaatjes):
              tmp = getImg(welke)
              tmp = tmp.resize(dimgsize)
              res = im.blend(tmp, dateImg,0.1)
              res.show()
              ph.save_image(res)
              welke -= 1
      
      blendAllImageMetDatum(m_plaatjes,n)
      
      def overlay2img(n):
      
          t1 = getImg(n-1)
          t2  = getImg(n-2)
          res = im.blend(t1,t2,0.5)
          res.show()
          ph.save_image(res)
      
      #overlay2img(n)
      

      and the gift to make a date picture: Sketch.py

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

        The ctypes module will be included in version 1.6 of Pythonista and is already available in the closed beta, though most likely whatever code you are trying to run won't work right away because of the differences between CPython on Windows/Mac/Linux and Pythonista on iOS.

        If you're trying to play sounds in Pythonista, have a look at the built-in sound module.

        To post code blocks on the forum, you need to add three backticks (```) before and after the code. If you can't type them with your keyboard layout, copy them from above.

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

          Thanks for repairing the code, will try to remember ;-)

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