X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fdc775af55c604458345c7045b8478fa230e3bce..466c166f5adeb00e3a61e9cefb8ab1195380eb5f:/wxPython/wx/lib/analogclock.py diff --git a/wxPython/wx/lib/analogclock.py b/wxPython/wx/lib/analogclock.py index 428cc27989..ce30eaa68d 100644 --- a/wxPython/wx/lib/analogclock.py +++ b/wxPython/wx/lib/analogclock.py @@ -20,6 +20,9 @@ # o Many ehnacements # +""" +`AnalogClockWindow` is a simple analog clock class. +""" import math import sys @@ -80,7 +83,7 @@ class AnalogClockWindow(wx.PyWindow): self.tickMarkHoursPen = wx.Pen((0, 0, 0), 1, wx.SOLID) self.tickMarkHoursBrush = wx.Brush((0, 0, 0), wx.SOLID) self.markSizeHour = 10 - self.tickMarkHoursFont = wx.Font(0, wx.SWISS, wx.NORMAL, wx.BOLD) + self.tickMarkHoursFont = wx.Font(1, wx.SWISS, wx.NORMAL, wx.BOLD) self.tickMarkHoursFont.SetPointSize(self.markSizeHour) self.tickMarkMinutesPen = wx.Pen((0, 0, 0), 1, wx.SOLID) @@ -136,7 +139,8 @@ class AnalogClockWindow(wx.PyWindow): def OnPaint(self, event): dc = wx.BufferedPaintDC(self) - self._doDrawHands(dc, True) + if hasattr(self, 'coords'): + self._doDrawHands(dc, True) def OnTimerExpire(self, event): @@ -455,17 +459,17 @@ class AnalogClockWindow(wx.PyWindow): drawDC.DrawPolygon(points) - def _pol2rect(self, r, w, deg=1): # radian if deg=0; degree if deg=1 + def _pol2rect(self, r, w, deg=1): # radian if deg=0; degree if deg=1 if deg: - w = math.pi * w / 180.0 + w = math.pi * w / 180.0 return r * math.cos(w), r * math.sin(w) - def _rect2pol(self, x, y, deg=1): # radian if deg=0; degree if deg=1 + def _rect2pol(self, x, y, deg=1): # radian if deg=0; degree if deg=1 if deg: - return math.hypot(x, y), 180.0 * math.atan2(y, x) / math.pi + return math.hypot(x, y), 180.0 * math.atan2(y, x) / math.pi else: - return math.hypot(x, y), math.atan2(y, x) + return math.hypot(x, y), math.atan2(y, x) def _center2corner(self, x, y, tipo, drawDC=None):