#๐Ÿ”’ countdown fuction repeating itself when i click too much

28 messages ยท Page 1 of 1 (latest)

midnight horizon
jaunty badgeBOT
#

@midnight horizon

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hollow swan
#

what do you mean doubling??

midnight horizon
#

everytime i call it

#

with the button

#

i can share the code with u

#

if you want

ivory patrol
#

what happens when you click on start, code wise?

midnight horizon
# ivory patrol what happens when you click on start, code wise?
 def update_time_pomodoro(self):
        if self.pomodorosecs != 0 and self.startpausepomodoro:
            self.pomodorosecs -=1
            self.listoftimers[self.current_tab].set(f"{self.pomodorosecs//60:02d}:{self.pomodorosecs%60:02d}")
            print(self.pomodorosecs)
            self.after(1000,self.update_time_pomodoro)
        elif self.pomodorosecs == 0:
            self.switch_tab()
    def pause_time_pomodoro(self):
        self.startpausepomodoro = False
        self.listofbuttons[self.current_tab].config(command=self.start_time_pomodoro, text="Start")
    def start_time_pomodoro(self):
        if not self.startpausepomodoro:
            self.startpausepomodoro = True
            self.listofbuttons[self.current_tab].config(command=self.pause_time_pomodoro, text="Pause")
            self.update_time_pomodoro()
hollow swan
midnight horizon
midnight horizon
oblique moat
oblique moat
#

Idk if that would help. That was just my intuition. I tried to rationalize it in a second comment and realized that I'm too tired to think.

midnight horizon
oblique moat
#

Damn, ok, nvm.

autumn spade
#

being called twice possibly?

ivory patrol
#

@midnight horizon can you check that the timer stops when you click the Pause button?

oblique moat
#

I originally thought that this was due to multiple timers being started due to the mishandling of the startpausepomodoro flag, but now that I'm looking at the code again, that doesn't seem possible.

midnight horizon
#

The seconds stopped

#

In the vid

#

When i click pause

jaunty badgeBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.