MCPcopy Create free account
hub / github.com/ActiveState/code / painthms

Method painthms

recipes/Python/578875_Analog_Clock/recipe-578875.py:214–231  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

212 ## Draws the handles.
213 #
214 def painthms(self):
215 self.canvas.delete(self._ALL) # delete the handles
216 T = datetime.timetuple(datetime.utcnow()-self.delta)
217 x,x,x,h,m,s,x,x,x = T
218 self.root.title('%02i:%02i:%02i' %(h,m,s))
219 angle = pi/2 - pi/6 * (h + m/60.0)
220 x, y = cos(angle)*0.70,sin(angle)*0.70
221 scl = self.canvas.create_line
222 # draw the hour handle
223 scl(self.T.windowToViewport(0,0,x,y), fill = self.timecolor, tag=self._ALL, width = self.pad/3)
224 angle = pi/2 - pi/30 * (m + s/60.0)
225 x, y = cos(angle)*0.90,sin(angle)*0.90
226 # draw the minute handle
227 scl(self.T.windowToViewport(0,0,x,y), fill = self.timecolor, tag=self._ALL, width = self.pad/5)
228 angle = pi/2 - pi/30 * s
229 x, y = cos(angle)*0.95,sin(angle)*0.95
230 # draw the second handle
231 scl(self.T.windowToViewport(0,0,x,y), fill = self.timecolor, tag=self._ALL, arrow = 'last')
232
233 ## Draws a circle at a given point.
234 #

Callers 1

redrawMethod · 0.95

Calls 5

cosFunction · 0.85
sinFunction · 0.85
windowToViewportMethod · 0.80
deleteMethod · 0.45
titleMethod · 0.45

Tested by

no test coverage detected