摘要: C++基础入门 1 C++初识 1.1 第一个C++程序 编写一个C++程序总共分为4个步骤 创建项目 创建文件 编写代码 运行程序 1.1.1 创建项目 ​ Visual Studio是我们用来编写C++程序的主要工具,我们先将它打开 1.1.2 创建文件 右键源文件,选择添加->新建项 给C++ 阅读全文
posted @ 2024-06-27 18:37 zwnsyw 阅读(9) 评论(0) 推荐(0) 编辑
摘要: C++核心编程 本阶段主要针对C++面向对象编程技术做详细讲解,探讨C++中的核心和精髓。 1 内存分区模型 C++程序在执行时,将内存大方向划分为4个区域 代码区:存放函数体的二进制代码,由操作系统进行管理的 全局区:存放全局变量和静态变量以及常量 栈区:由编译器自动分配释放, 存放函数的参数值, 阅读全文
posted @ 2024-06-27 18:34 zwnsyw 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 以下是关于Tkinter中获取和设置组件属性的一份简明指南: 获取组件属性 常规方法: 几乎所有的Tkinter组件都支持.cget()方法来获取属性值,以及可以直接通过键值对的方式读取属性。 # 假设 widget 是已创建的任意Tkinter组件实例 # 使用 .cget() 方法获取属性值 v 阅读全文
posted @ 2024-04-09 00:49 zwnsyw 阅读(195) 评论(0) 推荐(0) 编辑
摘要: import os # 获取当前工作目录 current_dir = os.getcwd() print(f"当前工作目录: {current_dir}") # 更改当前工作目录到指定路径 new_dir = "/path/to/your/directory" os.chdir(new_dir) # 阅读全文
posted @ 2024-01-20 16:22 zwnsyw 阅读(119) 评论(0) 推荐(0) 编辑
摘要: import os file_path = "C:\\path\\to\\your\\file_or_directory" os.startfile(file_path) 阅读全文
posted @ 2024-01-20 15:29 zwnsyw 阅读(216) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2023-11-30 21:38 zwnsyw 阅读(1) 评论(0) 推荐(0) 编辑
摘要: def singleton(cls): threadNames = [] # 线程名称列表 instances = {} # 实例字典 def get_instance(threadName, *args, **kwargs): """ 获取单例实例,通过线程名创建单例,保障每个线程里面的实例保持一 阅读全文
posted @ 2023-11-30 17:53 zwnsyw 阅读(6) 评论(0) 推荐(0) 编辑
摘要: # Python 3.5 之后可用,之前需要pip安装 from typing import TypedDict # 每个字段必须 class Person(TypedDict): name: str age: int qq: str p1_dict: Person = { "name": "大佬" 阅读全文
posted @ 2023-11-28 21:01 zwnsyw 阅读(75) 评论(0) 推荐(0) 编辑
摘要: import threading import time def singleton(cls): instances = {} def get_instance(*args, **kwargs): # 判断实例是否已经存在 if cls not in instances: # 如果不存在,创建新的实 阅读全文
posted @ 2023-11-28 20:13 zwnsyw 阅读(22) 评论(0) 推荐(0) 编辑
摘要: # 定义接口类 from abc import ABC, abstractmethod class Animal(ABC): @abstractmethod def speak(self): pass # 定义实现类 class Dog(Animal): def speak(self): retur 阅读全文
posted @ 2023-11-28 15:44 zwnsyw 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 1. Ctrl + 左键 :追溯源代码Ctrl + Alt + ←:后退 (可回到 追溯源代码 前)Ctrl + Alt + →:前进Ctrl + B:生命或用例 2.Ctrl + Alt + L:格式化代码 阅读全文
posted @ 2023-11-19 21:14 zwnsyw 阅读(20) 评论(0) 推荐(0) 编辑
摘要: import time def run_time(func): "计算运行时长装饰器" def wrapper(*args,**kwargs): # 包装函数 start = time.time() # 在调用装饰函数前干点事情 res = func(*args,**kwargs) end = ti 阅读全文
posted @ 2023-11-19 20:53 zwnsyw 阅读(16) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2023-11-17 16:44 zwnsyw 阅读(1) 评论(0) 推荐(0) 编辑
摘要: python tkinter事件循环中一直检测初始化加载文件有没有加载成功 import tkinter as tk def check_file_loaded(): # 检查文件是否加载成功的逻辑 if file_loaded: # 文件加载成功,执行相应操作 print("文件加载成功") el 阅读全文
posted @ 2023-11-02 19:20 zwnsyw 阅读(35) 评论(0) 推荐(0) 编辑
摘要: import cv2 import threading import tkinter as tk from PIL import Image, ImageTk class CameraThread(threading.Thread): def __init__(self, camera_index, 阅读全文
posted @ 2023-10-29 21:38 zwnsyw 阅读(107) 评论(0) 推荐(0) 编辑
摘要: # pip install wmi import wmi def get_camera_name(): camera_names = [] wmi_obj = wmi.WMI() cameras = wmi_obj.Win32_PnPEntity() for camera in cameras: i 阅读全文
posted @ 2023-10-29 21:37 zwnsyw 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 如果一个线程修改属性,而另一个线程读取相同的属性,那么在多线程环境中,为了确保数据的一致性,通常也需要使用锁来同步访问。 即使一个线程只读取属性而不修改它,也不能保证在读取的同时,另一个线程进行修改操作。如果没有适当的同步机制,可能会导致读取到不一致或不完整的数据。 以下是一个示例代码,演示了在一个 阅读全文
posted @ 2023-10-29 21:36 zwnsyw 阅读(14) 评论(0) 推荐(0) 编辑
摘要: turtle.forward(distance) 向当前画笔方向移动 distance 像素长度 turtle.backward(distance) 向当前画笔相反方向移动 distance 像素长度 turtle.right(degree) 顶时针移动 degree°角度 turtle.left( 阅读全文
posted @ 2023-10-18 16:48 zwnsyw 阅读(361) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python # -*- coding:utf-8 -*- import logging import time import os class Log(object): ''' 封装后的logging ''' def __init__(self, logger=None, l 阅读全文
posted @ 2023-10-17 14:20 zwnsyw 阅读(55) 评论(0) 推荐(0) 编辑
摘要: import win32gui import win32ui import win32con import numpy as np import cv2 import base64 # 通过句柄截取窗口内容 def capture_window_by_handle(handle): left, to 阅读全文
posted @ 2023-08-22 21:03 zwnsyw 阅读(280) 评论(0) 推荐(0) 编辑
摘要: ''' pip install numpy pip install opencv-python ''' from io import BytesIO import cv2 import numpy as np def pic_compress(pic_path, out_path, target_s 阅读全文
posted @ 2023-08-22 18:58 zwnsyw 阅读(37) 评论(0) 推荐(0) 编辑
摘要: import ctypes # 定义Windows API函数 import time user32 = ctypes.WinDLL("user32") user32.ShowWindow.argtypes = [ctypes.c_void_p, ctypes.c_int] user32.ShowW 阅读全文
posted @ 2023-08-02 23:48 zwnsyw 阅读(64) 评论(0) 推荐(0) 编辑
摘要: 1. https://alpha.bito.co/bitoai/需要输入邮箱获取验证码 2.https://chat-shared2.zhile.io/shared.html 输入个密码用来隔离,账号共享多 阅读全文
posted @ 2023-07-27 14:02 zwnsyw 阅读(1226) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2023-06-27 15:11 zwnsyw 阅读(0) 评论(0) 推荐(0) 编辑
摘要: import time import win32gui import win32api # 获取当前鼠标【x y】坐标 time.sleep(2) print("2秒内移动鼠标到对应窗口") point = win32api.GetCursorPos() print(point) # 通过坐标获取坐 阅读全文
posted @ 2023-06-27 15:06 zwnsyw 阅读(254) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2023-06-20 23:29 zwnsyw 阅读(9) 评论(0) 推荐(0) 编辑
摘要: from pynput import keyboard from multiprocessing import Process import multiprocessing, psutil def run(index): # index = 1 while True: index += 1 prin 阅读全文
posted @ 2023-05-30 20:52 zwnsyw 阅读(32) 评论(0) 推荐(0) 编辑
摘要: # 将该脚本和pyd放同一目录 import os #导入模块 filename = os.getcwd() #文件地址 list_path = os.listdir(filename) #读取文件夹里面的名字 for index in list_path: #list_path返回的是一个列表 通 阅读全文
posted @ 2023-05-24 14:20 zwnsyw 阅读(81) 评论(0) 推荐(0) 编辑
摘要: from pynput import keyboard # 监听键盘按下 def listenKey(): with keyboard.Listener(on_press=on_press, on_release=None) as (listener): listener.join() # 监听回调 阅读全文
posted @ 2023-05-24 01:38 zwnsyw 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 在 Tkinter 中隐藏和取消隐藏窗口 – Python 先决条件: Tkinter Python为开发 GUI(图形用户界面)提供了多种选择。在所有 GUI 方法中,Tkinter 是最常用的方法。它是Python附带的 Tk GUI 工具包的标准Python接口。 Python with Tk 阅读全文
posted @ 2023-05-23 20:26 zwnsyw 阅读(2391) 评论(0) 推荐(0) 编辑