Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64020

Re: Bind event is giving me a bug.

From Peter Otten <__peter__@web.de>
Subject Re: Bind event is giving me a bug.
Date 2014-01-15 22:25 +0100
Organization None
References <803c85f0-2f0f-4fc9-b043-710a77648546@googlegroups.com> <52D6F952.2010309@mrabarnett.plus.com>
Newsgroups comp.lang.python
Message-ID <mailman.5546.1389821146.18130.python-list@python.org> (permalink)

Show all headers | View raw


MRAB wrote:

> This will make it call 'get_text' when the button is clicked:
> 
>> Button(root, text = "Submit", command = get_text).pack()

...and then produce a TypeError because of the missing `event` argument. To 
avoid that you can provide a default with

def get_text(event=None):
    ...

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bind event is giving me a bug. eneskristo@gmail.com - 2014-01-15 12:16 -0800
  Re: Bind event is giving me a bug. Peter Otten <__peter__@web.de> - 2014-01-15 21:59 +0100
  Re: Bind event is giving me a bug. MRAB <python@mrabarnett.plus.com> - 2014-01-15 21:10 +0000
  Re: Bind event is giving me a bug. eneskristo@gmail.com - 2014-01-15 13:19 -0800
  Re: Bind event is giving me a bug. Peter Otten <__peter__@web.de> - 2014-01-15 22:25 +0100
  Re: Bind event is giving me a bug. Terry Reedy <tjreedy@udel.edu> - 2014-01-15 20:44 -0500

csiph-web