• upwart

    Super. That works!

    posted in Pythonista read more
  • upwart

    I have noticed that stash install a package in site-packages-3, but I would like it to be installed in site-packages.
    How can I force stash pip install to install in site-packages.
    BTW. I am running stash v0.7.2

    posted in Pythonista read more
  • upwart

    Is there a possibility to set the background colour of the console?
    For the foreground (text), there's console.set_color, but I can't seem to find a function to set the background.

    posted in Pythonista read more
  • upwart

    With the new Pythonista 3.3 (thanks Ole!), I ran into a problem with the Synchronator script, that I use regularly.
    The scripts hard codes the colour to be written text with as (0,0,0). As a solution I have just disabled the colour setting at all, so I can at least see what's going.
    But it would be nice if I could check the dark/light mode setting from Python.
    Or, maybe better yet, get the current theme colours.

    Would it be possible to force the console output to another theme?

    posted in Pythonista read more
  • upwart

    I just noticed that under Pythonista, it is not required to say
    import os,
    import sys or
    import shutil.
    That seems fine ... until you run the same script on another platform.

    So, be careful to import these modules explicitily in order to avoid problems when porting to another platform.

    posted in Pythonista read more
  • upwart

    @cvp
    This absolutely briliant!

    posted in Pythonista read more
  • upwart

    One of the mainstream UI packages (tkinter, PyQt, wxPython) please. Please!

    posted in Pythonista read more
  • upwart

    @brumm
    Thanks.That's very useful.

    posted in Pythonista read more
  • upwart

    As much as I like Pythonista, we have to face the fact that there's no more development. Fortunately there's a very active, open source, Python environment for iOS/iPadOS called PyTo. And they have just released Python 3.8.
    Unfortunately I can't find a forum, like this one for that app. Is anyone aware of a user group or similar for PyTo?

    posted in Pythonista read more
  • upwart

    And PyTo is open source, so even if the developer is not anymore supporting the product (like seems the case with Pythonista) others can continue the product (at least in theory).

    posted in Pythonista read more
  • upwart

    @mithrendal
    You missed a K in the income: it's $ 30K ...

    posted in Pythonista read more
  • upwart

    If you install the font via AnyFont it becomes system wide available.
    Then you can just load it directly, without the need for a .ttf to be loaded.

    posted in Pythonista read more
  • upwart

    I can recommend the AnyFont, available in the App store.

    posted in Pythonista read more
  • upwart

    That's good news.
    Does this also hold for the soon to be released iPadOS?

    posted in Pythonista read more
  • upwart

    What about compatibility of the normal (non-Beta) version of Pythonista on iPad OS?

    posted in Pythonista read more
  • upwart

    @enceladus
    This GUI Customview is where the getter_setter would certainly be useful!

    posted in Pythonista read more
  • upwart

    @mikael
    Thanks for this great idea.
    I have renamed your decorator to getter_setter, to make the purpose of it more clear.

    Thus we define a decorator function:

    def getter_setter(func):
        return property(func, func)
    

    and then we can redo the example as:

    class Example:

    @getter_setter
    def my_property(self, *value):
        if value:
            self._my_property = value[0]
        else:
            return self._my_property
    

    or EAFP style:

    class Example:
    
        @getter_setter
        def my_property(self, *value):
            try:
                self._my_property = value[0]
            except IndexError:
                return self._my_property
    

    Optionally, we could define two more decorators for getter only and setter only properties:

    def getter(func):
        def raise_attribute_error(*args):
            raise AttributeError("can't set attribute")
        return property(func, raise_attribute_error)
        
    
    def setter(func):
        def raise_attribute_error(*args):
            raise AttributeError("can't get attribute")
        return property(raise_attribute_error, func)
    
    

    Here is an example of a Circle class demonstrating the three decorators.
    radius can be used to get the radius and set the radius (thus updating the _area attribute)
    area can be used to get the area only. Setting will raise an error.
    diameter can only be used to set the radius. You can’t get it.

    Here is an implementation with getter_setter only:

    import math
    
    
    class Circle:
        def __init__(self, radius):
            self.radius = radius
            
        @getter_setter
        def radius(self, *value):
            if value:
                self._radius = value[0]
                self._area = math.pi * self._radius ** 2
            else:
                return self._radius
                
        @getter_setter
        def area(self, *value):
            if value:
                raise AttributeError("can't set attribute")
            else:
                return self._area
                
        @getter_setter
        def diameter(self, *value):
            if value:
                self.radius = value[0] / 2
            else:
                raise AttributeError("can't get attribute")
    
    And if we use getter and setter as well:
    
    import math
    
    
    class Circle:
        def __init__(self, radius):
            self.radius = radius
            
        @getter_setter
        def radius(self, *value):
            if value:
                self._radius = value[0]
                self._area = math.pi * self._radius ** 2
            else:
                return self._radius
                
        @getter
        def area(self):
            return self._area
                
        @setter
        def diameter(self, value):
            self.radius = value / 2

    posted in Pythonista read more
  • upwart

    You can't install opencv on Python, unfortunately,

    posted in Pythonista read more
  • upwart

    That's very bad news. Let's hope Ole is listening and working on it.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!