{"id":456,"date":"2017-05-13T03:38:06","date_gmt":"2017-05-12T22:08:06","guid":{"rendered":"https:\/\/sandeepmathew.wordpress.com\/?p=456"},"modified":"2017-05-13T03:38:06","modified_gmt":"2017-05-12T22:08:06","slug":"silly-little-pomodoro-timer-using-tkinter","status":"publish","type":"post","link":"https:\/\/sandeepmathew.com\/index.php\/2017\/05\/13\/silly-little-pomodoro-timer-using-tkinter\/","title":{"rendered":"Silly Little Pomodoro Timer using Tkinter"},"content":{"rendered":"<p>https:\/\/en.wikipedia.org\/wiki\/Pomodoro_Technique<br \/>\nSeems to work \ud83d\ude42<\/p>\n<p>[sourcecode language=&#8221;Text&#8221;]<br \/>\nimport Tkinter<br \/>\nfrom Tkinter import *<br \/>\nimport time<br \/>\nimport math<br \/>\nimport tkMessageBox<\/p>\n<p>tickCount = 0<br \/>\ndivisions = 25<\/p>\n<p>def drawClock( clockArea ):<br \/>\n     global tickCount<br \/>\n     global divisions<br \/>\n     tetha = ( 2 * math.pi ) \/ divisions<br \/>\n     tickCount = tickCount + 1<br \/>\n     clockArea.create_oval(10,10,190,190,width=10,fill=&quot;blue&quot;)<br \/>\n     clockArea.create_line(  100, 100, 100 + 60 * math.sin(tetha * ( tickCount &#8211; 1 ) ), 100 &#8211; 60 *  math.cos(tetha * ( tickCount &#8211; 1) ),width =3 )<br \/>\n     print ( tickCount)<br \/>\n     if ( tickCount  == divisions):<br \/>\n         tkMessageBox.showinfo(&quot;Time up!&quot;, &quot;Time up!&quot;)<br \/>\n         tickCount = 0<br \/>\n         return<br \/>\n     clockArea.after(1000 * 60 , lambda: drawClock(clockArea) )<br \/>\ndef reset(clockArea):<br \/>\n    global tickCount<br \/>\n    global divisions<br \/>\n    tickCount = 0<br \/>\n    divisions = 25<br \/>\n    drawClock(clockArea)<\/p>\n<p>def takeBreak(clockArea):<br \/>\n    global divisions<br \/>\n    tickCount = 0<br \/>\n    divisions = 5<br \/>\n    drawClock(clockArea)<\/p>\n<p>if __name__ == &quot;__main__&quot;:<br \/>\n    root = Tk()<br \/>\n    root.resizable(0,0)<br \/>\n    root.title(&quot;Pomodoro Timer&quot;)<br \/>\n    clockArea = Canvas(root,width=200,height=200)<br \/>\n    clockArea.create_oval(10,10,190,190,width=10,fill=&quot;blue&quot;)<br \/>\n    clockArea.create_line ( 100,100, 100, 20, width = 3 )<br \/>\n    clockArea.pack()<br \/>\n    clockArea.after(1000 * 60 , lambda: drawClock(clockArea))<br \/>\n    resetButton = Button(root,    text=&quot;Reset&quot;,width=25,command=lambda:reset(clockArea) )<br \/>\n    resetButton.pack()<br \/>\n    takeBreakButton = Button(root,text=&quot;TakeBreak&quot;,width=25,command=lambda:takeBreak(clockArea) )<br \/>\n    takeBreakButton.pack()<br \/>\n    root.mainloop()<\/p>\n<p>[\/sourcecode]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/en.wikipedia.org\/wiki\/Pomodoro_Technique Seems to work \ud83d\ude42 [sourcecode language=&#8221;Text&#8221;] import Tkinter from Tkinter import * import time import math import tkMessageBox tickCount = 0 divisions = 25 def drawClock( clockArea ): global tickCount global divisions tetha = ( 2 * math.pi ) \/ divisions tickCount = tickCount + 1 clockArea.create_oval(10,10,190,190,width=10,fill=&quot;blue&quot;) clockArea.create_line( 100, 100, 100 + 60 * [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/posts\/456"}],"collection":[{"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/comments?post=456"}],"version-history":[{"count":0,"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/posts\/456\/revisions"}],"wp:attachment":[{"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/media?parent=456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/categories?post=456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sandeepmathew.com\/index.php\/wp-json\/wp\/v2\/tags?post=456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}