Is there a way that while running pygame, I can also run the console too?

前端 未结 2 830
伪装坚强ぢ
伪装坚强ぢ 2021-01-19 17:02

I was wondering if there is a way, in python, that while my graphical piece inside my games.screen.mainloop() is running, if I can do something like get user input through r

2条回答
  •  离开以前
    2021-01-19 17:21

    The thing is about that is if you do something like raw_input it will stop the program until that input is entered so that will stop the program every loop to take input but you can do things like print but they will print every loop

    if you want to take input use InputBox Module this will make a little input box pop up on the screen thats in the loop

    if you want to do it from the console you could try Threading it which im not to familiar with but you can check it out Multi-threading Tutorial

    here is a questions that might help you out

    Pygame writing to terminal

    Good Luck! :)

提交回复
热议问题