Skip to content

Instantly share code, notes, and snippets.

@kiok46
Created June 10, 2018 09:55
Show Gist options
  • Select an option

  • Save kiok46/5cd3a1350776b8ab2e778808b9fc6ff8 to your computer and use it in GitHub Desktop.

Select an option

Save kiok46/5cd3a1350776b8ab2e778808b9fc6ff8 to your computer and use it in GitHub Desktop.
Plyer: Platform independent compatibility layer
# utils.py file.
class Proxy(object):
...
def __init__(self, name, facade):
...
def _ensure_obj(self):
...
name = object.__getattribute__(self, '_name')
module = 'plyer.platforms.{}.{}'.format(
platform, name)
mod = __import__(module, fromlist='.')
obj = mod.instance()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment