Re: Bind event is giving me a bug.

2014-01-15 Thread Terry Reedy
On 1/15/2014 3:16 PM, eneskri...@gmail.com wrote: While working with tkinter in python 3.3, I had the following problem. Please paste working code that people can experiment with. from tkinter import * def get_text(event): If this were a method, (which the indent of the body suggests it on

Re: Bind event is giving me a bug.

2014-01-15 Thread Peter Otten
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): ... --

Re: Bind event is giving me a bug.

2014-01-15 Thread eneskristo
Thank you, I thought Enter was Enter, but I still have this problem, when I press the Button, this appears: Exception in Tkinter callback Traceback (most recent call last): File "C:\Python33\lib\tkinter\__init__.py", line 1475, in __call__ return self.func(*args) TypeError: get_text() missin

Re: Bind event is giving me a bug.

2014-01-15 Thread MRAB
On 2014-01-15 20:16, eneskri...@gmail.com wrote: While working with tkinter in python 3.3, I had the following problem. def get_text(event): self.number_of_competitors = entered_text.get() try: self.number_of_competitors = int(self.number_of_competitors)

Re: Bind event is giving me a bug.

2014-01-15 Thread Peter Otten
eneskri...@gmail.com wrote: > While working with tkinter in python 3.3, I had the following problem. > root = Tk() > label = Label(root, text = "Enter the number of competitors.") > label.pack(side = TOP) > entered_text = Entry(root) > entered_text.pack() > Button(root, text = "Submit", command =

Bind event is giving me a bug.

2014-01-15 Thread eneskristo
While working with tkinter in python 3.3, I had the following problem. def get_text(event): self.number_of_competitors = entered_text.get() try: self.number_of_competitors = int(self.number_of_competitors) except: pass