Thứ Sáu, 25 tháng 10, 2019

Happy brithday lập trình với ngôn ngữ Python

Không có nhận xét nào












Code:
import ctypes
import time
import cv2 as cv

G4 = 126
A4 = 198
B4 = 274
C5 = 352
D5 = 428
E5 = 505
F5 = 581
G5 = 657
t1 = 0.2
t2 = t1 * 2
t3 = t1 * 4
t4 = t1 * 8
def note(x, y):
    ctypes.windll.user32.SetCursorPos(x, 430)
    ctypes.windll.user32.mouse_event(2, 0, 0, 0, 0)
    time.sleep(y)
    ctypes.windll.user32.mouse_event(4, 0, 0, 0, 0)
note(G4,t1)
note(G4,t1)
note(A4,t2)
note(G4,t2)
note(C5,t2)
note(B4,t3)
note(G4,t1)
note(G4,t1)
note(A4,t2)
note(G4,t2)
note(D5,t2)
note(C5,t3)
note(G4,t1)
note(G4,t1)
note(G5,t2)
note(E5,t2)
note(C5,t1)
note(C5,t1)
note(B4,t2)
note(A4,t2)
note(F5,t1)
note(F5,t1)
note(E5,t2)
note(C5,t2)
note(D5,t2)
note(C5,t4)

cv.waitKey(0)
cv.destroyAllWindows()

Lập trình chơi Piano với ngôn ngữ Python, PyCharm

Web: http://nguyenvankhoa.com
Facebook: http://www.facebook.com/NguyenVanKhoaCom 
Đăng ký kênh youtube: http://goo.gl/rHDTKK
Rất mong được sự ủng hộ của quý vị
Xin trân trọng!

Không có nhận xét nào :

Đăng nhận xét