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.


    How to call 'self.__' outside of 'self'

    Pythonista
    game scene
    4
    15
    7943
    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.
    • techteej
      techteej last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • dgelessus
        dgelessus last edited by

        The .pyui file doesn't seem to be included in the gist.

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

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            Looks like your problem is that you update the color in an instance on HockeyScene ................
            But what you actually run is a new instance without the modified colors. See comment on gist.

            The other problem is that your players are only defined within setup, which doesn't run until you run the scene. You should define players within __init__ if you want those attributes to exist. See. Y comment three comments ago!

            I think it would make more sense to have your scene class take as arguments in __init__, the colors, or maybe player objects, rather than trying to modify an existing HockeyScene object from your color picker ui.

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

              Could you show how I could have the scene class take as arguments in __init__?

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

                When I try to do it, no colors show up at all, and the scene loads quite a bit longer.

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

                  Some suggestions add to gist comments.

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

                    This gives me the error:

                    AttributeError: 'tuple' object has no attribute 'title'

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

                      That is because a player_color_name is a string like 'Red' or 'Gold'. If you pass in a string with one of the color names in color_dict that will work better then passing in a tuple.

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

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Powered by NodeBB Forums | Contributors