Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/05/2012, 15:11
xogost
 
Fecha de Ingreso: mayo-2011
Mensajes: 4
Antigüedad: 13 años, 7 meses
Puntos: 1
Timer en Python

Buenas tardes, desde hace tres dias ando trabajando en una cuenta regresiva en python, todo iva bien hasta que fue necesario implementar un timer.

Mi codigo es este:

Código:
from Tkinter import *
import customTimerNew
from threading import * 

_t = None

def startPomodoro(pomodoro):
		_t = Timer(1, pomodoro.discountTime())
		#_t.start()

class Pomodoro:
	_form = None
	_master = None
	_reloj = None
	_timeLabel = "25:00"
	_timeout = 1

	def __init__(self):
		self.startApp(self._master)

	def startApp(self, master):
		self._form = Frame(master)
		self._form.pack()

		title = Label(self._form, text="Pomodoro by Xogost!")

		self._reloj = Label(self._form, text=self._timeLabel)

		startButton = Button(self._form, text="Iniciar Pomodoro", command=startPomodoro(self))

		title.pack()
		self._reloj.pack()
		startButton.pack()
		self._form.mainloop()

	def discountTime(self):
		runtime = self._timeLabel.split(':')
		if runtime[1] == "00":
			runtime[0] = int(runtime[0]) - 1
			runtime[1] = 59
		elif int(runtime[0]) == 0 and int(runtime[1]) == 0:
			self._timeout = 0
		else:
			runtime[1] = int(runtime[1]) - 1

		if int(runtime[1]) < 10 and int(runtime[0]) < 10:
			self._timeLabel = "0%d:0%d" % (int(runtime[0]), int(runtime[1]))
		elif int(runtime[1]) < 10:
			self._timeLabel = "%d:0%d" % (int(runtime[0]), int(runtime[1]))
		elif int(runtime[0]) < 10:
			self._timeLabel = "0%d:%d" % (int(runtime[0]), int(runtime[1]))
		else:
			self._timeLabel = "%d:%d" % (int(runtime[0]), int(runtime[1]))
		
		self._reloj.config(text=self._timeLabel)
		self._reloj.update_idletasks()
y el error es este:

Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1410, in _call_
return self.func(*args)
File "main.py", line 55, in startPomodoro
self._t.run()
File "/home/xogost/Documentos/Python/Pomodoro/customTimer.py", line 13, in run
self.handler()
TypeError: 'NoneType' object is not callable

Les agradezco si me pueden colaborar.