Fix gauge bars

This commit is contained in:
DarkPhoenix
2020-04-25 09:57:49 +03:00
parent 8a3a21972a
commit c46a59e3b1
2 changed files with 4 additions and 2 deletions

View File

@@ -254,7 +254,6 @@ class PyGauge(wx.Window):
w = rect.width
else:
w = rect.width * (float(value) / 100)
r = copy.copy(rect)
r.width = w
dc.DrawRectangle(r)
@@ -315,7 +314,8 @@ class PyGauge(wx.Window):
color,
gradient_color
)
dc.DrawBitmap(gradient_bitmap, r.left, r.top)
if gradient_bitmap is not None:
dc.DrawBitmap(gradient_bitmap, r.left, r.top)
# font stuff begins here
dc.SetFont(self.font)

View File

@@ -35,6 +35,8 @@ def DrawFilledBitmap(width, height, color):
def DrawGradientBar(width, height, gStart, gEnd, gMid=None, fillRatio=4):
if width == 0 or height == 0:
return None
canvas = wx.Bitmap(width, height)
mdc = wx.MemoryDC()