def compute_hash(evt): value = this().input_text if not value: alert("You need to enter a value") return hash_object = hashes[this().algo]() hash_object.update(value.encode()) hex_value = hash_object.hexdigest() this().hash_value = hex_value
def preload(self, *args): this = javascript.this() # this.load.setBaseURL = 'http://labs.phaser.io/' this.load.image('sky', 'assets/space3.png') this.load.image('logo', 'assets/logo.svg') this.load.image('red', 'assets/red.png')
def create(self, *args): this = javascript.this() this.add.image(400, 300, 'sky') particles = this.add.particles('red') emitter = particles.createEmitter({ 'speed': 100, 'scale': { 'start': 1, 'end': 0 }, 'blendMode': 'NORMAL' }) logo = this.physics.add.image(400, 100, 'logo') logo.setVelocity(200, 100) logo.setBounce(1, 1) logo.setCollideWorldBounds(True) emitter.startFollow(logo)
def wrapper(*args, **kwargs): args = (javascript.this(), *args) if inject_vue_instance else args args = tuple(Object.from_js(arg) for arg in args) kwargs = {k: Object.from_js(v) for k, v in kwargs.items()} return Object.to_js(fn(*args, **kwargs))
def created(): for name in hashes: this().algos.append(name) this().algo = next(iter(hashes))