0

I'm running Pygame and I'm wanting to ask a user for input (not from the terminal) in the middle of a function. TKinter has an edit box that you can wait until text is input. TKinter uses an event trigger when editbox.result is changed. Once the result is returned the function continues where it left off. Can you pause in pygame whilst waiting for user input, like Tkinter?

example...

def foo():  """ This function is called by a pygame event response """
    # do some stuff
    a = input('What is you\'re name? ')  # I want to change this
    # do some more stuff
    return
  • I have resolved this by splitting my function up with demarcation at the input. foo1() is called which runs some code then requests input. Once the input has been received foo2() runs the rest of the code. It's not as nice as Tkinter but works. Thanks for suggesting another answer to a similar question, but it wouldn't solve my issue (or I'm not familiar with threading yet) – Aussie Caveman Nov 02 '21 at 13:57

0 Answers0