• Kipekeedev


    If I remove the decorator


    I get an error:

    TypeError: Cannot show camera from main UI thread

    posted in Pythonista read more
  • Kipekeedev

    I know this is out of topic but I'm having trouble running this code. It freezes my app:

        def scan_document(self, sender):
            img = photos.capture_image()
            if not img:
            with io.BytesIO() as bIO:
                img.save(bIO, 'PNG')
                imgOut = ui.Image.from_data

    I don't know if you guys know a lot about the photos module but I can't find any good documentation.

    @ccc do you have a github post on it?

    posted in Pythonista read more
  • Kipekeedev

    Solved it!

    the_action = getattr(self, name + '_action')
    button.action = the_action

    posted in Pythonista read more
  • Kipekeedev


    Would this work?

    def scan_view_action(self,sender):
    def make_button(self,name):
        the_action = name + '_action'
        button.action = the_action

    Or is there any convenient way to do this to keep it DRY?

    posted in Pythonista read more
  • Kipekeedev

    I'm having a problem concatenating a string to a variable to create a method in my app. It goes something like this:

    # coding: utf-8
    import ui
    w,h = ui.get_screen_size()
    buttons = ''' Scan_View Show_View '''.split()
    class OCRApp(ui.View):
        def __init__(self):
            x,y,w,h = self.bounds
            self.background_color = 'orange'
            for i, button in enumerate(buttons):
                button = str(button).lower()
        def scan_view_action(self, sender):
            scanview = ui.load_view('scanview.pyui')
            scanview.background_color = 'red'
        def show_view_action(self,sender):
        def make_button(self,name, i):
            button = ui.Button(title=name)
            **the_action = name
            button.action = the_action()**
            button.center =w/2, (i*60)+(button.height*2)
            return button

    When I create a string on the variable 'the_action' and call it on 'button.action' I get an error ' TypeError: "str" object is not callable'.

    How do I go about doing this correctly?

    posted in Pythonista read more
  • Kipekeedev


    Great the first option seems pretty easy. I don't know if I can get all the testing done in only 200 request. But the second option seems pretty convenient also. Thanks for the help!

    posted in Pythonista read more
  • Kipekeedev

    Hello. I want to work on something different but I don't know if pythonista supports it so please help. Here it is.
    I want to create a program that takes an image (eg. taking a photo of an image with a large amount of text), reads the text and converts it to a manipulatable string. Does pythonista have this capability? If so, where do I start. Which modules should I import (pythonista or an external module)? I have a pretty good idea but if it's not possible I'll move to something else.


    posted in Pythonista read more
  • Kipekeedev


    So simple. But worked perfectly. Thanks

    posted in Pythonista read more
  • Kipekeedev


    Yes and it gives me and error that the value needs to be a ui.Image

    # example url
    url = 'http://is4.mzstatic.com/image/thumb/Music7/v4/53/fc/a2/53fca253-84b1-f2cd-4e17-98be502ec53c/UMG_cvrart_00602547534873_01_RGB72_1500x1500_15UMGIM41882.jpg/55x55bb-85.jpg'
    i = urlopen(url)
    b= BytesIO(i.read())
    img = Image.open(b)
    btn = ui.Button()
    btn.image  = img         #<<< TypeError: Expected a ui.Image

    posted in Pythonista read more
  • Kipekeedev

    Hello again. I recently received some great help on how to a group of url images to a view. It works perfectly.

    Here's the code

    import feedparser, ui, Image, requests
    from urllib2 import urlopen
    from io import BytesIO
    url = 'https://itunes.apple.com/us/rss/topsongs/limit=10/xml'
    def get_image_urls(itunes_url):
        for entry in feedparser.parse(itunes_url).entries:
            yield entry['summary'].partition('src="')[2].partition('"')[0]
    class AlbumView(ui.View):
        def __init__(self, image_urls):
            for i, url in enumerate(image_urls):
                #new code
                img = Image.open(BytesIO(urlopen(url)).read())
                button.image = img
                #old code
                image_view = ui.ImageView()
                image_view.x = (i % 5) * 128 + 10
                image_view.y = (i / 5) * 128 + 10

    But what I want to do is instead of a plain image I want each URL image to be a button. ( the url image is used as the button image).

    I used BytesIO but I get an error that it's returning an instance not an ImageI'm having a hard time converting to url image to a ui.Image , which the button image field takes.


    posted in Pythonista read more
  • Kipekeedev

    @ccc one question. Where did you get the number 128 in the image_view.x and y?

    posted in Pythonista read more
  • Kipekeedev

    @ccc wow! I didn't know it was so simple. Thanks for the sample code!!

    posted in Pythonista read more
  • Kipekeedev

    @ccc i would this the ui module would be more appropriate. Isn't scene and canvas more for a game interface?

    posted in Pythonista read more
  • Kipekeedev

    @Webmaster4o sounds great. I'll try this ASAP. Also what if I didn't want a cover flow, I was thinking more of a table of images.

    posted in Pythonista read more
  • Kipekeedev

    @ccc the url is


    And I'm requesting the "im:image" url

    posted in Pythonista read more
  • Kipekeedev

    Hello. I'm new to Pythonista. I'm working on a simple app that request data from a music api. What I want to do on my main view is show the image of the top 10 albums. I don't know how to implement this onto a view. My json data for the image uses a url. Is there a method that I can use to pass in the url the show the image? Can someone please give me a simple example of how to do this.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!