Timer is not counting up when in a Class system

2 days ago 7
ARTICLE AD BOX

I need help, and I am new to programming. I am trying to make a timer for this CodeSkulptor3 project for school. The timer was working just fine before I put it into a class, but now it's not working anymore.

The timer is supposed to count up by 1 each 1000 miliseconds if I understand it correctly, but it doesn't for some reason. It's stuck at zero.

Here's the CodeSkulptor project for the timer: https://py3.codeskulptor.org/#user310_rg3q8zVyI7dfCpR_1.py

Here's my code itself below. The timer class is near the bottom.

import simplegui import math import random #timer initalization time = 0 #game loop def draw_handler(canvas): global timerA #draw timer canvas.draw_text("Timer: " + str(time), (700, 50), 20, "LightBlue") class Timer: def timer_handler(): global time time += 1 if (time > 60): print("YOUR DONE STOP PLAYING") timer = simplegui.create_timer(1000, timer_handler) timerA.start() timerA = Timer frame = simplegui.create_frame('woah', 800, 600) frame.set_draw_handler(draw_handler) frame.start()
Read Entire Article