![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
tel_1392
这个作者很懒,什么都没留下…
展开
-
信号量或线程池前段
from threading import Thread,Semaphore import time import random sm = Semaphore(5) def task(name): sm.acquire() print(’%s 正在使用’%name) time.sleep(random.randint(1,5)) print(’%s 使用完毕’%name) sm.release() if name == ‘main’: for i in range(20): t = Thread(targ原创 2021-03-04 08:25:51 · 91 阅读 · 1 评论 -
2021-03-04
import pygame def playmusic(filename,loops =0, start=0.0,value=0.5): ‘’’ :param filename: 文件名 :param loops: 循环次数 :param start: 从多少秒开始 :param value: 设置播放音量,播放音量从0.0到1.0 :return: ''' flag = False pygame.mixer.init() # 音乐模块初始化 while 1: if flag == 0:原创 2021-03-04 07:51:09 · 115 阅读 · 1 评论 -
c#显示图片
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using OpenCvSharp; using OpenCvSharp.Exten原创 2021-02-13 19:31:03 · 1482 阅读 · 0 评论 -
c#视频
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using OpenCvSharp; using OpenCvSharp.Exten原创 2021-02-13 19:29:37 · 157 阅读 · 0 评论 -
彩虹笔
import cv2 import numpy as np def stackImages(scale,imgArray): rows = len(imgArray) cols = len(imgArray[0]) # & 输出一个 rows * cols 的矩阵(imgArray) print(rows,cols) # & 判断imgArray[0] 是不是一个list rowsAvailable = isinstance(imgArray[0], list) # & imgArr原创 2021-02-10 20:17:23 · 168 阅读 · 0 评论 -
多线程视频
import cv2 import threading import numpy as np import serial flag=False def mySerial(): global flag port = serial.Serial(“com1”,9600) if port.isOpen(): port.close() port.open() #port.open() while True: dat = port.readline() if dat: flag=Tru原创 2021-02-10 20:13:07 · 80 阅读 · 0 评论 -
多线程串口
import threading import time import serial import os import datetime port= serial.Serial(‘com1’,9600) if port.isOpen(): port.close() port.open() f= open(‘Serial.txt’,‘w+’) f.write(“nihao”) class threadDemo(threading.Thread): def init(self): threading.Threa原创 2021-02-10 20:08:58 · 233 阅读 · 1 评论