Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8588
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: get() attribute for Entry in Tkinter |
| Date | 2011-06-29 23:35 +0200 |
| Organization | None |
| References | <3e0341d0-e045-4f93-a816-1b304de4cd80@h12g2000pro.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.514.1309383320.1164.python-list@python.org> (permalink) |
Robert Upton wrote:
> I am in the process of generating a simple GUI that wants to read a
> string and print it to the terminal after engaging a button. I am
> running into a problem where Python says it does not understand the
> get() attribute for Entry.
Please don't paraphrase Python's error messages. Cut-and-paste the traceback
instead. This should give something like
$ python tmp_tk.py
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
File "tmp_tk.py", line 6, in Test
strVal = widgetEntry.get()
AttributeError: 'NoneType' object has no attribute 'get'
So the value of widgetEntry is None. How could that be?
> widgetEntry = Entry(textFrame).pack(side = LEFT)
The pack() method returns None; if you need a reference to the Entry widget
you have to split that line
widgetEntry = Entry(textFrame)
widgetEntry.pack(side=LEFT)
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
get() attribute for Entry in Tkinter Robert Upton <yybar85712@gmail.com> - 2011-06-29 12:15 -0700 Re: get() attribute for Entry in Tkinter Peter Otten <__peter__@web.de> - 2011-06-29 23:35 +0200
csiph-web