Home > other >  Real-time display dynamic curve in tkinter
Real-time display dynamic curve in tkinter

Time:04-09

I receive data from serial port and then want to display in the thinter dynamic curve, this is displayed on the canvas curve program
Def drawPic () :
# clear images, drawing the image before and after to make two won't overlap
DrawPic. F. lf ()
DrawPic. A=drawPic. F.a dd_subplot (111)
# drawing images need x, y
X=list (range (len (hxplot)))
Y=hxplot
# will these points into curve drawing
DrawPic. Amy polumbo lot (x, y)
DrawPic. A.s et_title (" Respiratory waveform ")
DrawPic. Canvas. The show ()

If __name__=="__main__ ':
Matplotlib. Use (' TkAgg ')
# on the Tk GUI to place a canvas, and use. The grid () to adjust the layout of the
DrawPic. F=Figure (figsize=(7, 2), dpi=100)
DrawPic. Canvas=FigureCanvasTkAgg (drawPic. J f, master=Leida)
DrawPic. Canvas. The show ()
DrawPic. Canvas. Get_tk_widget (). The grid (row=0, columnspan=3)
='drawing' Button (Leida, text, the command=drawPic, state=ACTIVE). The grid (row=1, the column=2, columnspan=3)
DrawPic. Canvas. The show ()


Can realize the function of the is now, click the button, could you please try to refresh the curve of the canvas, but I want to achieve is only one click button, curve have been updated

CodePudding user response:

Add a loop,

CodePudding user response:

How to add cycle? Plus cycle, cycle will finish, just to display the results of the last time
  • Related