示例#1
0
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
示例#2
0
    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')
示例#3
0
    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)
示例#4
0
 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))
示例#5
0
def created():
    for name in hashes:
        this().algos.append(name)
    this().algo = next(iter(hashes))