• Dunno whether it is good practice or not, but it is darn convienent. i say go for it! It means your action code does not even need to know which player it is

    If you look at the gist i posted, the times always add up perfectly, because i only call time() once, and make sure to update in the tap action with any fractional times. Also when displaying, be sure to display both sets of labels ( and total time) all using the same time() call.

  • edit:

    # coding: utf-8 import os, json def loadsettings(file): if os.path.exists(file): with open(file, "r") as f: return json.load(f) file = "test.pyui" settings = loadsettings(file) i = 0 for s in settings[0]: #show me dicts in list if s == 'nodes': print s + ' = ', for d in settings[0].values()[i]: print d print else: print s + ' = ' + str(settings[0].values()[i]) print i += 1 print 'get attributes of the first node:' print "settings[0].get('nodes')[0].values()[0] = " + str(settings[0].get('nodes')[0].values()[0])
  • Off Topic : my two cents and Freudian babble

    Sharing information is everything.

    I work in the events industry. Over 20 years as a vision tech, live audio engineer and more recently TD and production manager.

    For at least 15 of those years I've fought against the tendency of some professionals to want to hoard knowledge and not impart skills.

    All this achieves is bad practice across all sectors (hobby programming included) and eventually when one needs assistance one can't find skilled help as you get peers that don't have the skills to be supportive.

    Any argument that imparting knowledge disadvantages the teacher is based on nothing more than fear.

    I order to stay at the top of our game we must research and improve eternally. If we all strive to build on our skill-sets then naturally we will always be ahead of those newer to the game and behind those with more years of service than us. This is how it's meant to be.

    I shouldn't complain. Three months ago after a life changing event (ruptured aneurysm) I left the events production industry for a permanent job at a University working as a trainer. Now I get to choose how knowledge is imparted every day.

    I've got time to breathe and time to learn all those things I'd been putting off. Like Python...

  • @omz Whenever I try that, I get an error that says "Expected a texture object".

  • https://github.com/jsbain/uicomponents/blob/master/ui_settings_storage.py

    Here is a more flexible method, intended to be used with @brumm's approach. Create a custom attribute "stored" (either programmatically or in ui editor), then this method creates a dict heirarchy of all storable elements. Supports deep heirarchies, and multiple components. Ideally each component and container view has a name attribute. it will create a temporary key if it does not (but if you change the ui later, such that subviews are added in different order, it will most likely fail to restore).

    Incidentally... json does not let you use non-string dict keys... the above approch uses yaml, which is similar, but faithfully reproduces the dicts.

Internal error.

Oops! Looks like something went wrong!