小编Und*_*ead的帖子

如果只有一个实例才有意义,我应该使用一个类吗?

我是一名初学Pythoon程序员,致力于基于本教程设置Flask视频服务器.我遇到问题的代码用于初始化计算机网络摄像头并输出帧:

class Camera(object):
    thread = None  # background thread that reads frames from camera
    frame = None  # current frame is stored here by background thread
    last_access = 0  # time of last client access to the camera
    start_time = 0  # time at which the camera is started

    def __init__(self):
        """Start the background camera thread if it isn't running yet."""
        ...

    def get_frame(self):
        """Return the current camera frame."""
        ...

    @staticmethod
    def frames():
        """"Generator that returns frames from …
Run Code Online (Sandbox Code Playgroud)

python oop class object

1
推荐指数
1
解决办法
63
查看次数

标签 统计

class ×1

object ×1

oop ×1

python ×1