def drawCenterPolygon(self, gc):
"""Draw the polygon at the center of the pie menu.
"""
gc.PushState()
# set border and fill colors
gc.SetPen(wx.Pen((80,80,80), 2))
gc.SetBrush(wx.Brush((0,0,0)))
# radius of circle that circumscribes the polygon
radius = 0.1 * self.winRadius
points = radius * np.array((np.cos(self.angles), np.sin(self.angles))).T
# draw the polygon
gc.DrawLines(points)
gc.PopState()
python类Pen()的实例源码
def drawBars(self, gc):
"""Draw the bars reaching to the menu cells.
"""
gc.SetPen(wx.Pen((80,80,80), 2))
# figure bar width using number of bars and apothem of polygon
r = 0.1 * self.winRadius
barWidth = np.sqrt((r*(np.cos(self.angle)-1.0))**2+(r*np.sin(self.angle))**2)
apothem = r * np.cos(self.angle/2.0)
# for each angle, color, choice triple
for angle, color, choice in zip(self.midAngles, self.curColors, self.choices):
# set fill color
gc.SetBrush(wx.Brush(color))
# figure bar length
barLength = self.bars[choice] * (0.70*self.winRadius - apothem)
# smallRadius
# rotate and draw bar
gc.PushState()
gc.Rotate(angle)
gc.DrawRectangle(apothem, -barWidth/2.0, barLength, barWidth)
gc.PopState()
def draw(self, dc, printerScale, coord=None):
colour = self.attributes['colour']
width = self.attributes['width'] * printerScale * self._pointSize[0]
style = self.attributes['style']
if not isinstance(colour, wx.Colour):
if IsNotWX4():
colour = wx.NamedColour(colour)
else:
colour = wx.Colour(colour)
pen = wx.Pen(colour, width, style)
pen.SetCap(wx.CAP_BUTT)
dc.SetPen(pen)
if coord is None:
if len(self.scaled): # bugfix for Mac OS X
dc.DrawLines(self.scaled)
else:
dc.DrawLines(coord) # draw legend line
def __init__(self, points, **attr):
"""
Creates PolyMarker object
:param `points`: sequence (array, tuple or list) of (x,y) points
:keyword `attr`: keyword attributes, default to:
================================ ================================
'colour'= 'black' wx.Pen Colour any wx.Colour
'width'= 1 Pen width
'size'= 2 Marker size
'fillcolour'= same as colour wx.Brush Colour any wx.Colour
'fillstyle'= wx.BRUSHSTYLE_SOLID wx.Brush fill style (use wx.BRUSHSTYLE_TRANSPARENT for no fill)
'style'= wx.FONTFAMILY_SOLID wx.Pen style
'marker'= 'circle' Marker shape
'legend'= '' Line Legend to display
================================ ================================
Marker Shapes:
- 'circle'
- 'dot'
- 'square'
- 'triangle'
- 'triangle_down'
- 'cross'
- 'plus'
"""
PolyPoints.__init__(self, points, attr)
def draw(self, dc, printerScale, coord=None):
colour = self.attributes['colour']
width = self.attributes['width'] * printerScale * self._pointSize[0]
size = self.attributes['size'] * printerScale * self._pointSize[0]
fillcolour = self.attributes['fillcolour']
fillstyle = self.attributes['fillstyle']
marker = self.attributes['marker']
if colour and not isinstance(colour, wx.Colour):
colour = wx.Colour(colour)
if fillcolour and not isinstance(fillcolour, wx.Colour):
fillcolour = wx.Colour(fillcolour)
dc.SetPen(wx.Pen(colour, width))
if fillcolour:
dc.SetBrush(wx.Brush(fillcolour, fillstyle))
else:
dc.SetBrush(wx.Brush(colour, fillstyle))
if coord == None:
if len(self.scaled): # bugfix for Mac OS X
self._drawmarkers(dc, self.scaled, marker, size)
else:
self._drawmarkers(dc, coord, marker, size) # draw legend marker
def DrawPointLabel(self, dc, mDataDict):
"""This is the fuction that defines how the pointLabels are plotted
dc - DC that will be passed
mDataDict - Dictionary of data that you want to use for the pointLabel
As an example I have decided I want a box at the curve point
with some text information about the curve plotted below.
Any wxDC method can be used.
"""
# ----------
dc.SetPen(wx.Pen(wx.BLACK))
dc.SetBrush(wx.Brush(wx.BLACK, wx.BRUSHSTYLE_SOLID))
sx, sy = mDataDict["scaledXY"] # scaled x,y of closest point
# 10by10 square centered on point
dc.DrawRectangle(sx - 5, sy - 5, 10, 10)
px, py = mDataDict["pointXY"]
cNum = mDataDict["curveNum"]
pntIn = mDataDict["pIndex"]
legend = mDataDict["legend"]
# make a string to display
s = "Crv# %i, '%s', Pt. (%.2f,%.2f), PtInd %i" % (
cNum, legend, px, py, pntIn)
dc.DrawText(s, sx, sy + 1)
# -----------
def DrawFromSelectedNode(self, msg):
t = msg.replace("][", ",").replace("[", "").replace("]", "").split(",")
osx = int(t[0])
osy = int(t[1])
oex = int(t[2])
oey = int(t[3])
i = wx.Bitmap(os.path.join(self.screenShotDir, "screenshot.png"))
dc = wx.MemoryDC(i)
dc.SetPen(wx.Pen(wx.RED, 1))
#???(wxpython????drawline?drawlines, ??drawrect??????)
dc.DrawLine(osx, osy, osx, oey)
dc.DrawLine(osx, osy, oex, osy)
dc.DrawLine(oex, osy, oex, oey)
dc.DrawLine(osx, oey, oex, oey)
dc.SelectObject(wx.NullBitmap)
self.screenShot.SetBitmap(i)
self.Refresh(eraseBackground=True, rect=None)
def drawScore(self,dc):
dc.SetFont(self.smFont)
scoreLabelSize = dc.GetTextExtent(u"SCORE")
bestLabelSize = dc.GetTextExtent(u"BEST")
curScoreBoardMinW = 15*2+scoreLabelSize[0]
bstScoreBoardMinW = 15*2+bestLabelSize[0]
curScoreSize = dc.GetTextExtent(str(self.curScore))
bstScoreSize = dc.GetTextExtent(str(self.bstScore))
curScoreBoardNedW = 10+curScoreSize[0]
bstScoreBoardNedW = 10+bstScoreSize[0]
curScoreBoardW = max(curScoreBoardMinW,curScoreBoardNedW)
bstScoreBoardW = max(bstScoreBoardMinW,bstScoreBoardNedW)
dc.SetBrush(wx.Brush((187,173,160)))
dc.SetPen(wx.Pen((187,173,160)))
dc.DrawRoundedRectangle(505-15-bstScoreBoardW,40,bstScoreBoardW,50,3)
dc.DrawRoundedRectangle(505-15-bstScoreBoardW-5-curScoreBoardW,40,curScoreBoardW,50,3)
dc.SetTextForeground((238,228,218))
dc.DrawText(u"BEST",505-15-bstScoreBoardW+(bstScoreBoardW-bestLabelSize[0])/2,48)
dc.DrawText(u"SCORE",505-15-bstScoreBoardW-5-curScoreBoardW+(curScoreBoardW-scoreLabelSize[0])/2,48)
dc.SetTextForeground((255,255,255))
dc.DrawText(str(self.bstScore),505-15-bstScoreBoardW+(bstScoreBoardW-bstScoreSize[0])/2,68)
dc.DrawText(str(self.curScore),505-15-bstScoreBoardW-5-curScoreBoardW+(curScoreBoardW-curScoreSize[0])/2,68)
def drawTiles(self,dc):
dc.SetFont(self.scFont)
for row in range(4):
for col in range(4):
value = self.data[row][col]
color = self.colors[value]
if value==2 or value==4:
dc.SetTextForeground((119,110,101))
else:
dc.SetTextForeground((255,255,255))
dc.SetBrush(wx.Brush(color))
dc.SetPen(wx.Pen(color))
dc.DrawRoundedRectangle(30+col*115,165+row*115,100,100,2)
size = dc.GetTextExtent(str(value))
while size[0]>100-15*2:
self.scFont = wx.Font(self.scFont.GetPointSize()*4/5,wx.SWISS,wx.NORMAL,wx.BOLD,face=u"Roboto")
dc.SetFont(self.scFont)
size = dc.GetTextExtent(str(value))
if value!=0: dc.DrawText(str(value),30+col*115+(100-size[0])/2,165+row*115+(100-size[1])/2)
def draw(self):
l, t, r, b = 35,35,15,35
w = self.width - l - r
h = self.height - t - b
if self.data is None:return
dc = wx.BufferedDC(wx.ClientDC(self), self.buffer)
dc.Clear()
left, low, right, high = self.extent
self.draw_coord(dc, w, h, l, t, r, b)
for xs, ys, c, lw in self.data:
ys = h+t - (ys - low)*(h/(high-low))
xs = l+(xs-left)*(1.0/(right-left)*w)
pts = list(zip(xs, ys))
dc.SetPen(wx.Pen(c, width=lw, style=wx.SOLID))
dc.DrawLines(pts)
def draw(self, dc, f, **key):
dc.SetTextForeground((255,255,0))
font = wx.Font(8, wx.FONTFAMILY_DEFAULT,
wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
dc.SetFont(font)
dc.SetPen(wx.Pen((0,255,0), width=1, style=wx.SOLID))
dc.SetBrush(wx.Brush((0,255,0)))
pos = [f(*(i[1], i[0])) for i in self.xy[self.msk]]
for i in pos:dc.DrawCircle(int(i[0]), int(i[1]), 2)
dc.SetPen(wx.Pen((255,0,0), width=1, style=wx.SOLID))
dc.SetBrush(wx.Brush((255,0,0)))
pos = [f(*(i[1], i[0])) for i in self.xy[~self.msk]]
for i in pos:dc.DrawCircle(int(i[0]), int(i[1]), 2)
def draw(self, dc, f, **key):
dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
dc.SetTextForeground(Setting['tcolor'])
font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
dc.SetFont(font)
dc.DrawLines([f(*i) for i in self.buf])
for i in self.buf:dc.DrawCircle(f(*i),2)
for line in self.body:
dc.DrawLines([f(*i) for i in line])
for i in line:dc.DrawCircle(f(*i),2)
pts = np.array(line)
mid = (pts[:-1]+pts[1:])/2
dis = norm((pts[:-1]-pts[1:]), axis=1)
unit = 1 if self.unit is None else self.unit[0]
for i,j in zip(dis, mid):
dc.DrawText('%.2f'%(i*unit), f(*j))
def draw(self, dc, f, **key):
dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
dc.SetTextForeground(Setting['tcolor'])
linefont = wx.Font(8, wx.FONTFAMILY_DEFAULT,
wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
dc.SetFont(linefont)
dc.DrawLines([f(*i) for i in self.buf])
for i in self.buf:dc.DrawCircle(f(*i),2)
for line in self.body:
dc.DrawLines([f(*i) for i in line])
for i in line:dc.DrawCircle(f(*i),2)
pts = np.array(line)
v1 = pts[:-2]-pts[1:-1]
v2 = pts[2:]-pts[1:-1]
a = np.sum(v1*v2, axis=1)*1.0
a/=norm(v1,axis=1)*norm(v2,axis=1)
ang = np.arccos(a)/np.pi*180
for i,j in zip(ang,line[1:-1]):
dc.DrawText('%.0f'%i, f(*j))
def draw(self, dc, f, **key):
dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
dc.SetTextForeground(Setting['tcolor'])
font = wx.Font(10, wx.FONTFAMILY_DEFAULT,
wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
dc.SetFont(font)
dc.DrawLines([f(*i) for i in self.buf])
for i in self.buf:dc.DrawCircle(f(*i),2)
for pg in self.body:
plg = Polygon(pg)
dc.DrawLines([f(*i) for i in pg])
for i in pg: dc.DrawCircle(f(*i),2)
area, xy = plg.area, plg.centroid
if self.unit!=None:
area *= self.unit[0]**2
dc.DrawText('%.1f'%area, f(xy.x, xy.y))
def draw(self, dc, f, **key):
dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
dc.SetTextForeground(Setting['tcolor'])
linefont = wx.Font(10, wx.FONTFAMILY_DEFAULT,
wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
dc.SetFont(linefont)
if len(self.buf)>1:
dc.DrawLines([f(*i) for i in self.buf])
for i in self.buf:dc.DrawCircle(f(*i),2)
for line in self.body:
dc.DrawLines([f(*i) for i in line])
for i in line:dc.DrawCircle(f(*i),2)
pts = np.array(line)
mid = (pts[:-1]+pts[1:])/2
dxy = (pts[:-1]-pts[1:])
dis = norm(dxy, axis=1)
unit = 1 if self.unit is None else self.unit[0]
for i,j in zip(dis, mid):
dc.DrawText('%.2f'%(i*unit), f(*j))
def Draw(self, dc):
dc.SetPen(wx.Pen(self.P_color))
dc.SetBrush(wx.Brush(self.B_color))
if self.Primary:
for e in self.eyes:
if e.obj == 1:
dc.SetPen(wx.Pen(wx.Colour(112,173,71)))
elif e.obj == 2:
dc.SetPen(wx.Pen(wx.Colour(237,125,49)))
else:
dc.SetPen(wx.Pen(self.P_color))
dc.DrawLine(self.pos_x, self.pos_y,
self.pos_x + e.SightDistance*math.sin(self.dir_Angle + e.OffSetAngle),
self.pos_y - e.SightDistance*math.cos(self.dir_Angle + e.OffSetAngle))
super(Agent, self).Draw(dc)
def OnDrawItem(self, dc, rect, item, flags):
if item == wx.NOT_FOUND:
# painting the control, but there is no valid item selected yet
return
font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, 'Segoe UI')
dc.SetFont(font)
if flags == 3:
margin = 3
else:
margin = 1
r = wx.Rect(*rect) # make a copy
r.Deflate(margin, margin)
tam = self.OnMeasureItem(item)-2
dc.SetPen(wx.Pen("grey", style=wx.TRANSPARENT))
color_name = self.GetString(item)
color = self.colors.get(color_name)
if not color:
color = wx.NamedColour(color_name)
dc.SetBrush(wx.Brush(color))
dc.DrawRectangle(r.x, r.y, tam, tam)
dc.DrawText(self.GetString(item), r.x + tam + 2, r.y)
def Draw(self,dc):
dc.SetPen(wx.Pen(self.P_color))
for i in range(0, len(self.xList)-1):
dc.DrawLine(self.xList[i], self.yList[i], self.xList[i+1],self.yList[i+1])
def Draw(self, dc):
dc.SetPen(wx.Pen(self.P_color))
dc.SetBrush(wx.Brush(self.B_color))
dc.DrawCircle(self.pos_x, self.pos_y, self.rad)
def Draw(self, dc):
dc.SetPen(wx.Pen(self.P_color))
dc.DrawLine(self.pos_x, self.pos_y,
self.pos_x + self.EYE.OverHang*math.cos(self.dir_Angle + self.EYE.OffSetAngle),
self.pos_y - self.EYE.OverHang*math.sin(self.dir_Angle + self.EYE.OffSetAngle))
super(Agent, self).Draw(dc)
def OnTimer(self, event):
if self.World is not None:
# Graphics Update
self.bdc = wx.BufferedDC(self.cdc, self.bmp)
self.gcdc = wx.GCDC(self.bdc)
self.gcdc.Clear()
self.gcdc.SetPen(wx.Pen('white'))
self.gcdc.SetBrush(wx.Brush('white'))
self.gcdc.DrawRectangle(0,0,640,640)
for ag in [self.World.A]:
ag.Draw(self.gcdc)
self.World.BBox.Draw(self.gcdc)
self.World.Course.Draw(self.gcdc)
def onPaint(self, e):
w,h = self.GetSize()
dc = wx.AutoBufferedPaintDC(self)
# Surface
dc.SetBrush(wx.Brush(COLOR_BACK))
dc.DrawRectangle(0, 0, w+1, h+1)
# Le quadrillage
dc.SetPen(wx.Pen(COLOR_GRID, 2))
# for i in range(0, 600, 25):
# dc.DrawLine(0, i, w, i)
# dc.DrawLine(i, 0, i, h)
dc.SetBrush(wx.Brush(COLOR_GRID,style=wx.TRANSPARENT))
for i in range(8):
dc.DrawCircle(w/2,h/2,GRID_CIRCLE_RADIUS*(7*i))
# dc.DrawCircle(300,300,CIRCLE_RADIUS*(7*i))
for i in range(self.numSpeakers):
vars.getVars("Speakers")[i].draw(dc, COLOR_AV)
vars.getVars("Speakers")[i].drawZone(dc, COLOR_AV)
# ecriture de valeurs
if self.catch:
# conversion des positions X et Y entre 0 et 1
x = self.pos[0] / float(w)
y = 1.- self.pos[1] / float(h)
# affiche la position normalisee du pointeur
dc.DrawText("%.3f, %.3f" % (x,y), 10, 10)
# Les cercles
self.blueCircle.draw(dc,COLOR_BLUE)
self.redCircle.draw(dc,COLOR_RED)
def draw(self,dc,color):
dc.SetPen(wx.Pen(color, 1))
dc.SetBrush(wx.Brush(color))
dc.DrawCircle(self.x, self.y, self.c)
# à l'appel, cette fonction ajuste la position du rectangle
# pour l'utilisation de la fonction ContainsXY
self.rect.x = self.x - self.c
self.rect.y = self.y - self.c
def draw(self,dc,color):
numero = self.getNumOut()
dc.SetPen(wx.Pen(COLOR_BACK, 1))
dc.SetBrush(wx.Brush(color))
dc.DrawCircle(self.x, self.y, self.c)
dc.DrawText("%d" % numero, self.x-(self.c/3),self.y-(self.c/1.75))
self.rect.x = self.x - self.c
self.rect.y = self.y - self.c
def drawZone(self,dc,color):
radius = self.getZoneRad()
dc.SetPen(wx.Pen(color,1))
dc.SetBrush(wx.Brush(wx.Colour(100,100,100,75)))
dc.DrawCircle(self.x,self.y,radius)
def __init__(self):
self.coords = np.array([0.0,0.0])
self.velocity = np.array([0.0,0.0])
self.pen = wx.Pen((250,250,250), 2)
self.brush = wx.Brush((255,255,255))
def DrawROI(self):
object = self.object
bmp = self.image.GetBitmap()
w = bmp.GetWidth()
h = bmp.GetHeight()
roi = [0]*6
for i in range(3):
roi[2*i] = int(self.roi[2*i].value.GetValue()) - 1
roi[2*i+1] = int(self.roi[2*i+1].value.GetValue())
axis = int(self.scrollaxis.value.GetValue())
if axis == 1:
x1 = int(float(w*roi[4])/float(object.shape[2]) +0.5)
x2 = int(float(w*(roi[5]))/float(object.shape[2]) -0.5)
y1 = int(float(h*roi[2])/float(object.shape[1]) +0.5)
y2 = int(float(h*(roi[3]))/float(object.shape[1]) -0.5)
elif axis == 2:
x1 = int(float(w*roi[4])/float(object.shape[2]) +0.5)
x2 = int(float(w*(roi[5]))/float(object.shape[2]) -0.5)
y1 = int(float(h*roi[0])/float(object.shape[0]) +0.5)
y2 = int(float(h*(roi[1]))/float(object.shape[0]) -0.5)
elif axis == 3:
x1 = int(float(w*roi[2])/float(object.shape[1]) +0.5)
x2 = int(float(w*(roi[3]))/float(object.shape[1]) -0.5)
y1 = int(float(h*roi[0])/float(object.shape[0]) +0.5)
y2 = int(float(h*(roi[1]))/float(object.shape[0]) -0.5)
self.dc = wx.MemoryDC(bmp)
self.dc.SelectObject(bmp)
self.dc.SetPen(wx.Pen(wx.RED, 1))
self.dc.SetBrush(wx.TRANSPARENT_BRUSH)
self.dc.DrawLine(x1, 1, x1, h)
self.dc.DrawLine(x2, 1, x2, h)
self.dc.DrawLine(1, y1, w, y1)
self.dc.DrawLine(1, y2, w, y2)
self.dc.SelectObject(wx.NullBitmap)
self.image.SetBitmap(bmp)
self.Layout()
def DrawROI(self):
object = self.object
bmp = self.image.GetBitmap()
w = bmp.GetWidth()
h = bmp.GetHeight()
roi = [0]*6
for i in range(3):
roi[2*i] = int(self.roi[2*i].value.GetValue()) - 1
roi[2*i+1] = int(self.roi[2*i+1].value.GetValue()) - 1
axis = int(self.scrollaxis.value.GetValue())
if axis == 1:
rx = int(float(w*roi[4])/float(object.shape[2]) +0.5)
rw = int(float(w*(roi[5] - roi[4] +1.0))/float(object.shape[2]) +0.5)
ry = int(float(h*roi[2])/float(object.shape[1]) +0.5)
rh = int(float(h*(roi[3] - roi[2] +1.0))/float(object.shape[1]) +0.5)
elif axis == 2:
rx = int(float(w*roi[4])/float(object.shape[2]) +0.5)
rw = int(float(w*(roi[5] - roi[4] +1.0))/float(object.shape[2]) +0.5)
ry = int(float(h*roi[0])/float(object.shape[0]) +0.5)
rh = int(float(h*(roi[1] - roi[0] +1.0))/float(object.shape[0]) +0.5)
elif axis == 3:
rx = int(float(w*roi[2])/float(object.shape[1]) +0.5)
rw = int(float(w*(roi[3] - roi[2] +1.0))/float(object.shape[1]) +0.5)
ry = int(float(h*roi[0])/float(object.shape[0]) +0.5)
rh = int(float(h*(roi[1] - roi[0] +1.0))/float(object.shape[0]) +0.5)
self.dc = wx.MemoryDC(bmp)
self.dc.SelectObject(bmp)
self.dc.SetPen(wx.Pen(wx.RED, 1))
self.dc.SetBrush(wx.TRANSPARENT_BRUSH)
self.dc.DrawRectangle(rx, ry, rw, rh)
self.dc.SelectObject(wx.NullBitmap)
self.image.SetBitmap(bmp)
self.Layout()
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.ancestor = parent
self.fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize()
self.colour = wx.Colour(30,70,115, alpha=wx.ALPHA_OPAQUE)
self.canvas = PlotCanvas(self)
if IsNotWX4():
self.canvas.SetInitialSize(size=self.GetClientSize())
self.canvas.SetShowScrollbars(True)
self.canvas.SetEnableZoom(False)
self.canvas.SetFontSizeAxis(point=12)
self.canvas.SetFontSizeTitle(point=12)
self.canvas.SetGridColour(wx.Colour(0, 0, 0))
self.canvas.SetForegroundColour(wx.Colour(0, 0, 0))
self.canvas.SetBackgroundColour(wx.Colour(255, 255, 255))
else:
self.canvas.axesPen = wx.Pen(self.colour, width=1, style=wx.PENSTYLE_SOLID)
self.canvas.SetForegroundColour(wx.Colour(0, 0, 0))
self.canvas.SetBackgroundColour(wx.Colour(255, 255, 255))
self.canvas.enableGrid = (True,True)
self.canvas.fontSizeAxis = self.fontpointsize
self.canvas.fontSizeTitle = self.fontpointsize
self.vbox = wx.BoxSizer(wx.VERTICAL)
self.vbox.Add(self.canvas, 1, flag=wx.LEFT | wx.TOP | wx.GROW)
self.paused = False
self.hbox_btn = wx.BoxSizer(wx.HORIZONTAL)
self.hbox_btn.AddSpacer(20)
self.button_pause =wx.Button(self, label="Pause Graph")
self.Bind(wx.EVT_BUTTON, self.OnClickPauseButton, self.button_pause)
self.hbox_btn.Add(self.button_pause)
self.button_save =wx.Button(self, label="Save Data")
self.Bind(wx.EVT_BUTTON, self.OnClickSaveButton, self.button_save)
self.hbox_btn.Add(self.button_save)
self.vbox.Add(self.hbox_btn, 0, wx.EXPAND)
self.SetSizer(self.vbox)
self.Fit()
self.Show()
self.data_poll_timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.UpdateGraph, self.data_poll_timer)
def __init__(self, points, **attr):
"""
Creates PolyLine object
:param `points`: sequence (array, tuple or list) of (x,y) points making up line
:keyword `attr`: keyword attributes, default to:
========================== ================================
'colour'= 'black' wx.Pen Colour any wx.Colour
'width'= 1 Pen width
'style'= wx.PENSTYLE_SOLID wx.Pen style
'legend'= '' Line Legend to display
========================== ================================
"""
PolyPoints.__init__(self, points, attr)