[Tutor] How to get input from Tkinter app ?

David Holland davholla2002 at yahoo.co.uk
Fri Dec 10 18:28:41 CET 2004

Here is an example create a function eg createwidgets(self)

with code like

        self.question_ent = Entry(self)

       self.question_ent.grid(row=0, column = 4, columnspan = 2, sticky = W)

Then in another function eg getinfo(self) which is fired off by a button or something

write code like :-

question = self.question_ent.get()

this will get the info that the user had put in.  Put some error handling code in case the user puts something stupid in (or nothing).  Which will return to screen any mistakes.

I hope this makes sense this is the first time I have helped anyone !

Win a castle  for NYE with your mates and Yahoo! Messenger 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20041210/32d4faf1/attachment.htm

More information about the Tutor mailing list