Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103423
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Peter Otten <__peter__@web.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: exit from Tkinter mainloop Python 2.7 |
| Date | Tue, 23 Feb 2016 23:45:08 +0100 |
| Organization | None |
| Lines | 41 |
| Message-ID | <mailman.82.1456267517.20994.python-list@python.org> (permalink) |
| References | <56e451a3-01f7-4883-b4db-c3a6a10729a9@googlegroups.com> <naimao$327$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Trace | news.uni-berlin.de APwcL3RKq4vhvjyltKMZxQPqYMjPaxU0lwXQ44UbyynQ== |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'root': 0.04; 'subject:Python': 0.05; 'none.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:2.7': 0.09; 'def': 0.13; 'advice,': 0.16; 'entryname': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:Tkinter': 0.16; 'wrote:': 0.16; 'deleted.': 0.18; 'widget': 0.18; 'tkinter': 0.22; 'import': 0.24; 'sort': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'error': 0.27; 'values': 0.28; 'print': 0.30; 'window': 0.30; 'entry': 0.31; 'exist': 0.35; 'i.e.': 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'method': 0.37; 'received:org': 0.37; 'christian': 0.38; 'why': 0.39; 'does': 0.39; 'subject:from': 0.39; 'skip:e 20': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'some': 0.40; 'close': 0.61; 'export': 0.63; 'grab': 0.64; 'believe': 0.66; 'below.': 0.66; 'therefore': 0.67; 'children.': 0.76; 'click': 0.76; 'gollwitzer': 0.84; 'window,': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | p57bd9d8e.dip0.t-ipconnect.de |
| User-Agent | KNode/4.13.3 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:103423 |
Show key headers only | View raw
Christian Gollwitzer wrote:
> Am 23.02.16 um 22:39 schrieb kevind0718@gmail.com:
>> from Tkinter import *
>>
>> def butContinue():
>> root1.destroy()
>> [...]
>> entryName = Entry(root1).grid(row=1, column=1, pady=5)
>> [...]
>> butGo = Button(root1, text=" Continue " , command=butContinue
>> ).grid(row=3, column=1, sticky=W, pady=10)
>>
>> root1.mainloop()
>>
>> print entryName.get("1.0", "end-1c" )
>
>> When I click on butGo I get the error below.
>> So is this some sort of scope error?
>> why does entryName not exist for me to grab it's value?
>
> You call destroy() on the root window of Tk. If you destroy a window,
> that will destroy all of it's children. Therefore by deleting the root
> window, also the entryName widget was deleted. You need to export the
> values before you close the window, i.e. in the butContinue() function.
Even when you follow this advice, entryName was set to None by the line
>> entryName = Entry(root1).grid(row=1, column=1, pady=5)
as grid() always returns None. You need two steps
entryName = Entry(root1)
entryName.grid(row=1, column=1, pady=5)
Also,
>> print entryName.get("1.0", "end-1c" )
I believe that the Entry widget's get() method doesn't take any arguments.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
exit from Tkinter mainloop Python 2.7 kevind0718@gmail.com - 2016-02-23 13:39 -0800
Re: exit from Tkinter mainloop Python 2.7 Christian Gollwitzer <auriocus@gmx.de> - 2016-02-23 23:29 +0100
Re: exit from Tkinter mainloop Python 2.7 Peter Otten <__peter__@web.de> - 2016-02-23 23:45 +0100
Re: exit from Tkinter mainloop Python 2.7 Christian Gollwitzer <auriocus@gmx.de> - 2016-02-23 23:33 +0100
Re: exit from Tkinter mainloop Python 2.7 kevind0718@gmail.com - 2016-03-04 13:50 -0800
Re: exit from Tkinter mainloop Python 2.7 Peter Otten <__peter__@web.de> - 2016-03-04 23:28 +0100
Re: exit from Tkinter mainloop Python 2.7 Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-09 11:17 -0800
Re: exit from Tkinter mainloop Python 2.7 Dave Farrance <df@see.replyto.invalid> - 2016-02-24 09:34 +0000
csiph-web