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.
Using abstract classes with ui.View
-
I am just doing some testing with Abstract classes. I would like to start using them to help with the design of my classes and also help with a consistent approach. From what I read the code below should not work, it should fail as an abstract method in the child class is not defined. But, I think I am having problems because I am inheriting from ui.View. Is there something special about ui.View that does not allow combining it with abstract classes?
Any help appreciated.import ui from abc import ABCMeta, abstractmethod #template custom class class base_std(ui.View): __metaclass__ = ABCMeta def __init__(self): pass def ui_elements_create(): pass @abstractmethod def style(self): pass def layout(self): pass class my_class(base_std): def __init__(self): pass #def style(self): #pass if __name__ == '__main__': cls= my_class() cls.present('sheet')