Advertisement
Guest User

Untitled

a guest
Jul 12th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. for i in range(1):
  2.  
  3.     import matplotlib.pyplot as plt
  4.     import matplotlib.animation as animation
  5.     import pylab
  6.     from tkinter import *
  7.     import numpy as np
  8.  
  9.     fig=plt.figure()
  10.     ax1=fig.add_subplot(1,1,1)
  11.     def animate(i):
  12.         bb=[]
  13.         a=0
  14.             #Координата начала отрезка
  15.         x_0 = 0.0
  16.         y_0 = 0.0
  17.             #Координата конца отрезка
  18.         x_1 = 0.0
  19.         y_1 = 1.0
  20.             # Ожидание нажатия клавиши
  21.         a = input()
  22.             # Если нажата кнопка, присваиваем y_1=1
  23.         if len(a) > 0:
  24.             y_1 = 1.0
  25.         bb.append([x_0,x_1])
  26.         bb.append([y_0,y_1])
  27.         ax1.clear()
  28.         animation1=ax1.plot(*bb,color='grey')
  29.     ani=animation.FuncAnimation(fig,animate,interval=10)
  30.     plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement