+ 1
How do I combine these with Pyscript?
i know only beginner level html and have only written a few python scripts go easy on me. Sample input would be GUARD1 1 OPEN also does the html code need a spot for output? https://code.sololearn.com/cT9Y981anJ5I/?ref=app https://code.sololearn.com/W73G2rjuBD3N/?ref=app https://code.sololearn.com/WhSLrYt1L705/?ref=app
3 ответов
+ 2
You actually already figured out the solution in your previous question, maybe you just don't see it yet.
You seem to have some sort of a game concept here. A game has a flow, a series of steps or 'events'. The event loop controls the duration of the game. In your code, this is an endless while loop:
while True:
You actually need to change this part. Remove the loop completely, and remove the input() statements. Instead you need to write a function (def) where you handle only a single event. The function has no parameters, because the actual arguments will be read from the html input elements. And it's up to you how you want to display the output. You can write it to the console with the print statement, or use a html element such as a div, where you either replace the text content or append to it every time when a new event occurs. You have already done this in your other question.
Finally what you already discovered is you can put a pys-onClick attribute on your button which will trigger this function.
0
I guess i dont know how to take multiple inputs except with multiple args? im not sure where to begin writing that function...Would you be kind enough to point me towards some information i could look at to work through it? I want to write it but not sure if i dont know or i put in too many hours yesterday. at one point i typed the actual word code instead of code i was so tired haha
https://code.sololearn.com/WhSLrYt1L705/?ref=app
0
Where im at. Trying to replace variables with html input
https://code.sololearn.com/W16otZ0zBckI/?ref=app