Advertisement
Geocrack

console_pyscript

Sep 12th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.79 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.  
  5. <head>
  6.   <!--<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />-->
  7.   <script defer src="https://pyscript.net/alpha/pyscript.js"></script>
  8. </head>
  9.  
  10. <body>
  11.   <div>Textfeld_1</div>
  12.   <input type="text" id="test-input"/>
  13.   <button id="submit-button" type="submit" pys-onClick="my_function">OK</button>
  14.   <div id="test-output"></div>
  15.  
  16. <py-script>
  17. from js import console
  18.  
  19. def my_function(*args, **kwargs):
  20.  
  21.     #print('args:', args)
  22.     #print('kwargs:', kwargs)
  23.  
  24.     console.log(f'args: {args}')
  25.     console.log(f'kwargs: {kwargs}')
  26.    
  27.     text = Element('test-input').element.value
  28.  
  29.     #print('text:', text)
  30.     console.log(f'text: {text}')
  31.  
  32.     Element('test-output').element.innerText = text
  33. </py-script>
  34.  
  35.   </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement