Discord
Login
Community
DARK THEME

js in Python

How can I write js code inside a Python project?

This code: //javascript

and also this one: system.javascript(""" ... """)

They don't work. Is there a way to make it work in Python?

Combining javascript code only works with MicroScript2 .

I don't write in python so I may be wrong .

We have to ask the MicroStudio authors about the possibility of adding Javascript to other languages ​​.

I once only made code that took events from the mouse . Maybe there is a way to call the "eval" command from javascript .

Then you could add code in javascript .

def update_position(event):
  global x, y
  x += event.movementX
  y += event.movementY  
  print("x:", x)
  pass

def lock_pointer(event):
    canvas.requestPointerLock()  
    
def init():
  global x, y
  x = 0
  y = 0
  #= 0, 0

  # canvas = document["canvas"]
  
  global canvas
  canvas = window.player.runtime.screen.canvas
  canvas.bind("mousemove", update_position)
  canvas.bind("click", lock_pointer)
  pass


def update():
    pass

def draw():
    pass

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community