omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    Drop Shadow behind ui.view()

    Pythonista
    5
    24
    17925
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • blmacbeth
      blmacbeth last edited by

      @Phuket2 I wish I have a cool trick up my sleeve! But to comment on your response about not calling super: it is best practice to call super when subclassing. This is because it allows you to refactor your code with less changes made afterwards.

      For example: let's say I someday make a kick-ass version of UIView and UIViewController that make ui.View look like children's toys. So, you want to incorporate the new view classes into your old code. The way you have, you would need to change every instance of ui.View.__init__(...). By calling super you no longer have to do all that tedious work. It makes life slightly easier.

      I'm not saying that what your doing is wrong; I have plenty of classes that do the same thing. But o have started using super because of the refactoring issue.

      Now, this could all be a load of bullshit I am feeding you, so go look it up yourself and let me know if I'm correct! 😛

      B.

      Phuket2 1 Reply Last reply Reply Quote 0
      • Phuket2
        Phuket2 @blmacbeth last edited by

        @blmacbeth , hmmm, I am a little on the drunk side now 🎉😎 almost 11:30pm here now. So maybe I should wait until tomorrow to look it up 😱
        But I started getting a problem when inheriting from multiple classes. Gets confusing about which base class is being called ( it did for me anyway). That's when I started using the implicit calls to base class's init methods instead. But I see your point though. I haven't managed to write anything significant enough in Python were it's been a problem to refactor 😭
        Still trying though

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          re needing to call View.init, see
          https://forum.omz-software.com/topic/2548/inheritance-and-kwargs-popping-consumption/5

          If you do not implement your own init, you do not need to call super init.
          If you have an init, you do need to call the View.init

          1 Reply Last reply Reply Quote 0
          • dgelessus
            dgelessus last edited by

            From what I've heard, you need to use super() for some aspects of multiple inheritance to work properly. I know almost nothing about the details of multiple inheritance on Python though, so I can't tell you why exactly that is and what would break otherwise. Mostly because multiple inheritance is not needed very often.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors