• ccc

    My sense was that this was cursor up, down, left, right buttons on the top row of the on-screen keyboard to the right of cut, copy, paste.

    posted in Pythonista read more
  • ccc

    You might be able to reduce repetitive code by adding a self.make_button() method that takes a few parameters and returns a ui.Button.

    posted in Pythonista read more
  • ccc

    You should use a list comprehension instead of a generator expression on line 17.

    posted in Pythonista read more
  • ccc

    Get rid of both c and i and do for color in colors.

    range(len()) is almost always a sign that enumerate() should be used instead but here we don’t even need that.

    posted in General Discussion read more
  • ccc

    @cvp said:

    content = str(response.content.decode('utf-8'))

    text = response.text

    posted in Pythonista read more
  • ccc

    Apple does not allow this for obvious reasons. We also do not want to encourage spamming in this forum.

    posted in Pythonista read more
  • ccc

    The Pyto app does a better job of this than Pythonista does but it is a nontrivial task.

    posted in Pythonista read more
  • ccc

    So what happens when you move your scene to a different device? iPad, iPad Mini, iPhone small screen, iPhone XL screen? Also, when you rotate the screen.

    posted in Pythonista read more
  • ccc

    Please change ui.scene.Point to just Point (because the line from scene import * pollutes the global namespace with all members of the scene package which runs contrary to the advice of PEP8).

    The -> is using Python type hints to declare what data type this function returns. https://docs.python.org/3/library/typing.html

    The * says treat one object as several objects in an iterator. This is usually referred to as *args and **kwargs.

    posted in Pythonista read more
  • ccc

    Untested...

    def random_location(self) -> ui.scene.Point:
        return ui.scene.Point(*(random.randrange(x) for x in self.size))
    

    posted in Pythonista read more
  • ccc

    Perhaps provide 3 strings that you want the expression to match and three similar strings that you don’t want it to match. With that set of test cases, we will see what we can do.

    posted in Pythonista read more
  • ccc

    This is about Python 2 vs. Python 3... https://github.com/ymcui/Chinese-ELECTRA/pull/57

    The way to fix this and see if the r"string" == ur"string" or the u"string" == ur"string" and then use that string on both Py2 and Py3.

    #!/usr/bin/env python2
    # -*- coding: utf-8 -*-
    print(ur'anā\B' == r'anā\B')  # True
    print(ur'anā\B' == u'anā\B')  # True
    

    posted in Pythonista read more
  • ccc

    def make_label(text):
        return f"label({text})"
    
    data_from_mysql = (("Acme", 11), ("Bart's", 22), ("Carls's", 33))
    labels = []
    for name, count in data_from_mysql:
        labels.append(make_label(name))
        labels.append(make_label(count))
    
    print(labels)
    

    ['label(Acme)', 'label(11)', "label(Bart's)", 'label(22)', "label(Carls's)", 'label(33)']

    OK... So now we have a list of six labels... What is the question?

    posted in Pythonista read more
  • ccc

    It is easier to debug Python code than it is to debug English prose.

    posted in Pythonista read more
  • ccc

    Let's assume that you have the following function to reduce the boilerplate code:

    def make_label(text: str) -> ui.Label:
        return size_to_fit(ui.Label(
                    text=text,
                    #background_color='white',
                    alignment=ui.ALIGN_LEFT,
                    text_color='white',
                ))
    

    Now, rewrite the rest of your code to use that function and your question will become clearer.

    posted in Pythonista read more
  • ccc

    for i, name, count in enumerate(self.cur, start=1):

    posted in Pythonista read more
  • ccc

    username = input('Enter Username>>> ') 
    
    if username == 'silas':
        print('Access granted')
        print('Hello SILAS')
    else:
        print('Access Denied')
    

    posted in Pythonista read more
  • ccc

    There is a lot of good code here... It would be really awesome if there was a GitHub repo to stitch it all together into an app.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!