Sublime Forum

Getting User Data

#1

Getting user input in a function:

I’m writing a plugin that works with a users instance of a web application called stikked. I’m having a hard time getting input from the user.

I have

if args'reply'] == 'true':
			reply = self.view.window().show_input_panel("Reply to:", "", self.user_input, None, None)
			print reply.get_text()
			data = urllib.urlencode( {"title":self.cur_file(), "text":text, "name":author, "lang":self.cur_syntax(), "private":private, "reply":reply } )

and the function:

	def user_input(self, input):
		print "input: " + input
		return input

Unfortunately I can’t seem to figure out how to get the text the user inputted into the same function in which it was called. Any ideas?

0 Likes

#2

The on_done parameter (self.user_input in your case) is a callback. Move your urllib.urlencode call to that method.

0 Likes