1

I get this error : mySocket.send ( userInput ) TypeError: must be string or buffer, not instance

userInput = StringVar()
e = Entry(gui, textvariable=userInput)
e.pack()

def sendPacket():
mySocket = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
mySocket.connect ( ( 'CENSORED', 2727 ) )
mySocket.send ( userInput )

1 Answer 1

1

My tkinter is a bit rusty, but I think it's a simple oversight -- you need to call the StringVar.get() method to return it as an actual string, rather than referencing the StringVar object instance.

mySocket.send ( userInput.get() )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.