• lachlantula

    Hi all,
    I’m developing an application with the ui module, but have realised something that I’m not sure is either intentional or just overlooked; background_color can be animated, whilst text_color can’t.
    Here’s an example. You can see that the text colour-changing is out of sync with the smooth background. The text changes to contrast with the background at the time.

    Here is my code for the colour-changing functionality:

    while True:
        r = lambda: random.randint(0, 255)
        colour = '%02X%02X%02X' % (r(), r(), r())
        def determine_colour2(colour):
            (r, g, b) = (colour[:2], colour[2:4], colour[4:])
            # This next bit is pretty complicated, but its basically just an algorithm to find out what colour is needed for text
            if 1 - (int(r, 16) * 0.299 + int(g, 16) * 0.587 + int(b, 16) * 0.114) / 255 < 0.5:
                return '333333'
            else:
                return 'efefef'
        colour2 = determine_colour2(colour)  
        def animation():
            v.background_color = colour
            v['chrome']['logo'].text_color = colour2
        ui.animate(animation, duration = 3)
        time.sleep(3)
    

    If anyone can let me know if I’m doing something wrong or if this functionality isn’t implemented into Pythonista at all, it would be appreciated. Thanks!

    posted in Pythonista read more
  • lachlantula

    Hi all,
    A while ago Pythonista got the pycrypto module added in, which has been very useful. Unfortunately, though, this module is dead and is starting to gain security holes. PyCryptodome is a drop-in replacement, and all code should be backwards compatible. It also adds extra features and is being regularly updated. Check it out. Would be great if we could see this in Pythonista!
    Thanks

    posted in Pythonista read more
  • lachlantula

    Hi everyone, do we know if there's any plans for Pythonista to add features that increase compatibility with iOS 11 (ie. drag-and-drop, support for the Files app, etc)? Thanks

    posted in Pythonista read more
  • lachlantula

    good work! I'll definitely check this out.

    posted in Pythonista read more
  • lachlantula

    I would be very surprised if Apple never tried to make a 'UWP for Apple products'. Maybe it'll happen one day?

    posted in General Discussion read more
  • lachlantula

    Did you ever figure anything out?

    posted in Pythonista read more
  • lachlantula

    @omz will old packages still work if 3.6 is pushed to everyone? I need my pycrypto 🙂

    posted in Pythonista read more
  • lachlantula

    It seems like the "import file" function now available inside the share sheet only works 1/3 of the time for me and my mate. Is there a trick I'm missing or something?

    posted in Pythonista read more
  • lachlantula

    What @bennr01 said is probably the best choice, but if you ever want to download something else, use:

    import urllib.request
    urllib.request.urlretrieve("direct link to file", "filename.extension")
    

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!