python写的自动按键和鼠标连点

news2024/11/18 18:43:52

自己用python写的自动按键和鼠标自动点击。
分享一下源码,比较干净的,缺点就是是python打包有点大50多M

from PyQt5 import QtWidgets, uic, QtCore
from pynput import keyboard, mouse
import pygetwindow as gw
from PyQt5.QtGui import QPainter, QColor, QCursor
from PyQt5.QtCore import Qt, QRectF
from pynput.mouse import Button, Controller
 
import pyautogui
import threading
import time
import os
 
ui_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'form.ui')
 
key_time_dict = {}  # Global Dictionary to store keys and times
window = None # Global Window
controller = None   # Global Controller
mouseX = 0  # Global Mouse X
mouseY = 0  # Global Mouse Y
 
class MyLineEdit(QtWidgets.QLineEdit):
    def mousePressEvent(self, event):
        super(MyLineEdit, self).mousePressEvent(event)  # 让QLineEdit处理其鼠标点击事件
        print(f'----------------Mouse left button pressed: {event.text()}')
 
    def keyPressEvent(self, event):
        super(MyLineEdit, self).keyPressEvent(event)
        key = event.key()
        print(f'------------------Key pressed: {key}')
        # Now `key` holds the key code of the pressed key.
        # Do something with it…
        key_char = event.text()
        print(f'-----------------Pressed key char: {key_char}')
 
class ToggleButton(QtWidgets.QPushButton):
    def __init__(self, parent=None):
        super(ToggleButton, self).__init__(parent)
        self.setCheckable(True)
        self.setMinimumWidth(66)
        self.setMinimumHeight(28)
 
    def paintEvent(self, event):
        label = "ON" if self.isChecked() else "OFF"
        bg_color = QColor(0, 155, 0) if self.isChecked() else QColor(155, 155, 155)
 
        radius = 10
        width = 28
        center = self.rect().center()
 
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.translate(center)
        painter.setBrush(QColor(255, 255, 255))
 
        pen = painter.pen()
        pen.setWidth(2)
        pen.setColor(QColor(155, 155, 155))
        painter.setPen(pen)
 
        painter.drawRoundedRect(QRectF(-width, -radius, 2*width, 2*radius), radius, radius)
        painter.setBrush(QColor(bg_color))
        sw_rect = QRectF(-radius, -radius, width, 2*radius)
        if not self.isChecked():
            sw_rect.moveLeft(-width)
        else:
            sw_rect.moveRight(width)
        painter.drawRoundedRect(sw_rect, radius, radius)
        painter.setBrush(QColor(255, 255, 255))
        painter.drawText(sw_rect, Qt.AlignCenter, label)
 
 
class Ui(QtWidgets.QMainWindow):
    def __init__(self):
        super(Ui, self).__init__()
        uic.loadUi(ui_path, self)
 
        # ==================== KeyBoard Auto Press ====================
        self.button = self.findChild(QtWidgets.QPushButton, 'Add')
        self.button.clicked.connect(self.buttonClicked)
 
        self.line_edit = self.findChild(QtWidgets.QLineEdit, 'lineName')
        self.spin_box = self.findChild(QtWidgets.QDoubleSpinBox, 'doubleSpinBox')
        self.list_widget = self.findChild(QtWidgets.QListWidget, 'listWidget')
 
        self.statusButton = self.findChild(QtWidgets.QPushButton, 'statusButton')
        tmpParent = self.statusButton.parent()  # Store the parent of the QPushButton
        tmpGeometry = self.statusButton.geometry()  # Store the geometry of the QPushButton
        self.statusButton.setParent(None)  # Unparent the QPushButton
 
        self.statusButton = ToggleButton(self)  # Replace with ToggleButton
        # tmpParent.layout().addWidget(self.statusButton)  # Add the ToggleButton to the layout of the parent
 
        self.statusButton.setGeometry(tmpGeometry)  # Set geometry or place it where you want
        self.statusButton.clicked.connect(lambda: self.statusButtonClicked(keyboard.Key.f1))
        self.statusButton.toggled.connect(lambda: print(f"Toggle button state: {self.statusButton.isChecked()}"))
 
        # ==================== Mouse Auto Press ====================
 
        self.xPos = self.findChild(QtWidgets.QLineEdit, 'xPos')
        self.yPos = self.findChild(QtWidgets.QLineEdit, 'yPos')
        self.mouseDelay = self.findChild(QtWidgets.QDoubleSpinBox, 'mouseDelay')
 
        self.mouseStatusButton = self.findChild(QtWidgets.QPushButton, 'mouseStatusButton')
        tmpParent = self.mouseStatusButton.parent()  # Store the parent of the QPushButton
        tmpGeometry = self.mouseStatusButton.geometry()  # Store the geometry of the QPushButton
        self.mouseStatusButton.setParent(None)  # Unparent the QPushButton
 
        self.mouseStatusButton = ToggleButton(self)  # Replace with ToggleButton
        # tmpParent.layout().addWidget(self.statusButton)  # Add the ToggleButton to the layout of the parent
 
        self.mouseStatusButton.setGeometry(tmpGeometry)  # Set geometry or place it where you want
        # self.mouseStatusButton.clicked.connect(lambda: self.statusButtonClicked(keyboard.Key.f1))
        self.mouseStatusButton.toggled.connect(lambda: print(f"Toggle mouseStatusButton state: {self.mouseStatusButton.isChecked()}"))
 
        # ==================== Key Map ====================
        self.buttonAddMap = self.findChild(QtWidgets.QPushButton, 'AddMap')
        self.buttonAddMap.clicked.connect(self.addMapButtonClicked)
 
        self.fromKey = self.findChild(QtWidgets.QLineEdit, 'fromKey')
        self.toKey = self.findChild(QtWidgets.QLineEdit, 'toKey')
 
        tmpLineEditParent = self.fromKey.parent()  # Store the parent of the QPushButton
        tmpLineEditGeometry = self.fromKey.geometry()  # Store the geometry of the QPushButton
        self.fromKey.setParent(None)  # Unparent the QPushButton
        self.fromKey = MyLineEdit(self)  # Replace with ToggleButton
        self.fromKey.setGeometry(tmpLineEditGeometry)  # Set geometry or place it where you want
        # tmpLineEditParent.layout().addWidget(self.fromKey)  # Add the ToggleButton to the layout of the parent
 
        self.mapStatusButton = self.findChild(QtWidgets.QPushButton, 'mapStatusButton')
        tmpParent = self.mapStatusButton.parent()  # Store the parent of the QPushButton
        tmpGeometry = self.mapStatusButton.geometry()  # Store the geometry of the QPushButton
        self.mapStatusButton.setParent(None)  # Unparent the QPushButton
 
        self.mapStatusButton = ToggleButton(self)  # Replace with ToggleButton
        # tmpParent.layout().addWidget(self.statusButton)  # Add the ToggleButton to the layout of the parent
 
        self.mapStatusButton.setGeometry(tmpGeometry)  # Set geometry or place it where you want
        self.mapStatusButton.clicked.connect(lambda: self.statusButtonClicked(keyboard.Key.f4))
        self.mapStatusButton.toggled.connect(lambda: print(f"Toggle mapStatusButton state: {self.mapStatusButton.isChecked()}"))
 
        self.show()
 
    def buttonClicked(self):
        try:
            key = self.line_edit.text()
            time = self.spin_box.value()
            # 添加前检查是否重复,如果重复则不添加
            if key in key_time_dict or key not in pyautogui.KEYBOARD_KEYS:
                return
            key_time_dict[key] = time
            self.list_widget.addItem(f'Key: {key} : Sec: {time}')
        except Exception as e:
            print(e)
 
    # 按键映射添加按钮 @todo
    def addMapButtonClicked(self):
        try:
            key = self.line_edit.text()
            time = self.spin_box.value()
            # 添加前检查是否重复,如果重复则不添加
            if key in key_time_dict or key not in pyautogui.KEYBOARD_KEYS:
                return
            key_time_dict[key] = time
            self.list_widget.addItem(f'Key: {key} : Sec: {time}')
        except Exception as e:
            print(e)
    def statusButtonClicked(self, key):
        print("statusButtonClicked")
        try:
            controller.on_press(key)
        except Exception as e:
            print(e)
 
    def contextMenuEvent(self, event):
        try:
            widget = self.childAt(event.pos())
            if widget == self.list_widget or widget.parent() == self.list_widget:
                contextMenu = QtWidgets.QMenu(self)
                delAction = contextMenu.addAction("Delete")
 
                action = contextMenu.exec_(self.mapToGlobal(event.pos()))
                if action == delAction:
                    current_item = self.list_widget.currentItem()
                    if current_item:
                        row = self.list_widget.row(current_item)
                        self.list_widget.takeItem(row)
                        del key_time_dict[current_item.text().split(":")[1].strip()]
            else:
                print("No widget found")
        except Exception as e:
            print(e)
 
class Controller:
    MOUSE_STATUS_CLICK = 0
    MOUSE_STATUS_PRESS = 1
    def __init__(self):
        self.mouse_controller = mouse.Controller()
        self.mouse_pressed = False
        self.keyboard_stop_flag = True
        self.mouse_auto_stop_flag = True
 
    def on_press(self, key):
        try:
            # 检查游戏是否运行并且是当前活动窗口
            # game_windows = gw.getWindowsWithTitle(self.game_title)
            # if game_windows and gw.getActiveWindow() in game_windows:
                if key == keyboard.Key.f1:
                    if self.keyboard_stop_flag:
                        self.keyboard_stop_flag = False
                        window.statusButton.setChecked(True)
                        self.start_keyboard_press_key()
                    else:
                        self.keyboard_stop_flag = True
                        window.statusButton.setChecked(False)
                elif key == keyboard.Key.f2:
                    # 鼠标连点
                    if self.mouse_auto_stop_flag:
                        self.mouse_auto_stop_flag = False
                        window.mouseStatusButton.setChecked(True)
                        self.start_mouse_auto_click_key(self.MOUSE_STATUS_CLICK)
                    else:
                        self.mouse_auto_stop_flag = True
                        window.mouseStatusButton.setChecked(False)
                elif key == keyboard.Key.f3:
                    # 鼠标长按
                    if self.mouse_auto_stop_flag:
                        self.mouse_auto_stop_flag = False
                        window.mouseStatusButton.setChecked(True)
                        self.start_mouse_auto_click_key(self.MOUSE_STATUS_PRESS)
                    else:
                        self.mouse_auto_stop_flag = True
                        window.mouseStatusButton.setChecked(False)
                elif key == keyboard.Key.f4:
                    # 按键映射
                    pass
                elif key == keyboard.Key.f12:
                    mouse_pos = QCursor.pos()
                    global mouseX, mouseY
                    mouseX = mouse_pos.x()
                    mouseY = mouse_pos.y()
                    window.xPos.setText(str(mouseX))
                    window.yPos.setText(str(mouseY))
                else:
                    print(f"{key} pressed")
        except Exception as e:
            import traceback
            traceback.print_exc()
 
    def on_release(self, key):
        if key == keyboard.Key.esc:
            # Stop listener when escape key is released
            return False
 
    def on_mouse_press(self, x, y, button, pressed):
        if pressed:
            print(f'鼠标按键{button}被按下,位置在({x}, {y})')
 
    def on_mouse_release(self, x, y, button, pressed):
        if not pressed:
            print(f'鼠标按键{button}被释放,位置在({x}, {y})')
            # 如果你想在鼠标按键被释放后停止监听,可以返回False:
 
    def start_keyboard_press_key(self):
        for key, interval in key_time_dict.items():
            if key in pyautogui.KEYBOARD_KEYS:
                print("启动线程, 按键: ", key, " 间隔: ", interval)
                t = threading.Thread(target=self.press_key, args=(key, interval))
                t.daemon = True  # 设置为守护线程,当主线程结束时,此线程也会结束
                t.start()
            else:
                print(f"Key: {key} is not a valid key")
    def press_key(self, key, interval):
        print("按键: ", key, " 间隔: ", interval)
        while True:
            if self.keyboard_stop_flag:
                break
            pyautogui.press(key)
            time.sleep(interval)
 
    def start_mouse_auto_click_key(self, status):
        print("启动鼠标自动点击线程... ")
        if status == self.MOUSE_STATUS_CLICK:
            print(f"鼠标自动点击... delay:{window.mouseDelay.value()}")
            delay = window.mouseDelay.value()
            t = threading.Thread(target=self.mouse_click, args=(delay,))
            t.daemon = True  # 设置为守护线程,当主线程结束时,此线程也会结束
            t.start()
        elif status == self.MOUSE_STATUS_PRESS:
            print("鼠标长按... ")
            mouseC = mouse.Controller()
            mouseC
            pyautogui.mouseDown()
            t = threading.Thread(target=self.mouse_press)
            t.daemon = True
            t.start()
 
    def mouse_click(self, interval):
        print("鼠标自动点击, 间隔: ", interval)
        while True:
            if self.mouse_auto_stop_flag:
                break
            # 获取鼠标当前位置
            print("指定的坐标... {}, {}".format(mouseX, mouseY))
            if mouseX == 0 and mouseY == 0:
                mouseXx, mouseYy = pyautogui.position()
            else:
                mouseXx = mouseX
                mouseYy = mouseY
            pyautogui.click(int(mouseXx), int(mouseYy))
            time.sleep(interval)
    def mouse_press(self):
        print("开启鼠标长按... ")
        while True:
            if self.mouse_auto_stop_flag:
                # 释放鼠标左键并退出循环
                pyautogui.mouseUp()
                print("鼠标长按结束")
                break
            print("鼠标长按中... ")
            time.sleep(0.3)  # 暂停片刻,减少CPU使用率
 
 
 
# 启动键盘监听
def start_listener():
    game_title = "Your Game Title"  # 替换为你的游戏窗口标题
    global controller
    controller = Controller()
    # 启动一个守护线程
    print("启动线程监听...")
    daemon = threading.Thread(target=keyboard_listener, args=(controller,))
    daemon.daemon = True
    daemon.start()
    daemon = threading.Thread(target=mouse_listener, args=(controller,))
    daemon.daemon = True
    daemon.start()
def keyboard_listener(args):
    print("启动线程监听键盘...")
    controller = args
    with keyboard.Listener(
            on_press=controller.on_press,
            on_release=controller.on_release) as listener:
        listener.join()
def mouse_listener(args):
    print("启动线程监听鼠标...")
    controller = args
    with mouse.Listener(
            on_click=controller.on_mouse_press,
            on_release=controller.on_mouse_release) as listener:
        listener.join()
 
if __name__ == "__main__":
    app = QtWidgets.QApplication([])
    window = Ui()
    window.setWindowTitle("按键助手")
    start_listener()
    app.exec_()
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>wwwww</class>
 <widget class="QMainWindow" name="wwwww">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>500</width>
    <height>500</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QWidget" name="horizontalLayoutWidget">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>80</y>
      <width>173</width>
      <height>31</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout">
     <property name="spacing">
      <number>6</number>
     </property>
     <item>
      <widget class="QLabel" name="label_3">
       <property name="text">
        <string>按键:</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QLineEdit" name="lineName"/>
     </item>
     <item>
      <widget class="QPushButton" name="Add">
       <property name="text">
        <string>添加</string>
       </property>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="horizontalLayoutWidget_2">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>30</y>
      <width>171</width>
      <height>51</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_2">
     <item>
      <widget class="QLabel" name="label">
       <property name="text">
        <string>F1按键开关</string>
       </property>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="horizontalLayoutWidget_3">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>110</y>
      <width>97</width>
      <height>31</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_3">
     <item>
      <widget class="QLabel" name="label_4">
       <property name="text">
        <string>延迟:</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QDoubleSpinBox" name="doubleSpinBox"/>
     </item>
    </layout>
   </widget>
   <widget class="QListWidget" name="listWidget">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>140</y>
      <width>101</width>
      <height>73</height>
     </rect>
    </property>
   </widget>
   <widget class="QPushButton" name="statusButton">
    <property name="geometry">
     <rect>
      <x>140</x>
      <y>110</y>
      <width>73</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>PushButton</string>
    </property>
   </widget>
   <widget class="QPushButton" name="mouseStatusButton">
    <property name="geometry">
     <rect>
      <x>360</x>
      <y>110</y>
      <width>73</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>PushButton</string>
    </property>
   </widget>
   <widget class="QWidget" name="horizontalLayoutWidget_4">
    <property name="geometry">
     <rect>
      <x>260</x>
      <y>110</y>
      <width>97</width>
      <height>31</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_4">
     <item>
      <widget class="QLabel" name="label_5">
       <property name="text">
        <string>延迟:</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QDoubleSpinBox" name="mouseDelay"/>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="horizontalLayoutWidget_5">
    <property name="geometry">
     <rect>
      <x>260</x>
      <y>80</y>
      <width>173</width>
      <height>31</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_5">
     <property name="spacing">
      <number>6</number>
     </property>
     <item>
      <widget class="QLabel" name="label_6">
       <property name="text">
        <string>X:</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QLineEdit" name="xPos"/>
     </item>
     <item>
      <widget class="QLabel" name="label_7">
       <property name="text">
        <string>Y:</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QLineEdit" name="yPos"/>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="horizontalLayoutWidget_6">
    <property name="geometry">
     <rect>
      <x>260</x>
      <y>30</y>
      <width>224</width>
      <height>51</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_6">
     <item>
      <widget class="QLabel" name="label_2">
       <property name="text">
        <string>F2鼠标连点  F3鼠标长按 F12采集坐标 </string>
       </property>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QListWidget" name="listWidgetMap">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>380</y>
      <width>101</width>
      <height>73</height>
     </rect>
    </property>
   </widget>
   <widget class="QPushButton" name="mapStatusButton">
    <property name="geometry">
     <rect>
      <x>140</x>
      <y>350</y>
      <width>73</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>PushButton</string>
    </property>
   </widget>
   <widget class="QWidget" name="horizontalLayoutWidget_7">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>350</y>
      <width>97</width>
      <height>31</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_7">
     <item>
      <widget class="QLabel" name="label_11">
       <property name="text">
        <string>映射:</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QLineEdit" name="toKey"/>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="horizontalLayoutWidget_8">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>320</y>
      <width>173</width>
      <height>31</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_8">
     <property name="spacing">
      <number>6</number>
     </property>
     <item>
      <widget class="QLabel" name="label_9">
       <property name="text">
        <string>按键:</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QLineEdit" name="fromKey"/>
     </item>
     <item>
      <widget class="QPushButton" name="AddMap">
       <property name="enabled">
        <bool>true</bool>
       </property>
       <property name="text">
        <string>添加</string>
       </property>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QWidget" name="horizontalLayoutWidget_9">
    <property name="geometry">
     <rect>
      <x>40</x>
      <y>270</y>
      <width>171</width>
      <height>51</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_9">
     <item>
      <widget class="QLabel" name="label_10">
       <property name="text">
        <string>F4按键映射</string>
       </property>
      </widget>
     </item>
    </layout>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>500</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources/>
 <connections/>
</ui>

成品如图:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1112829.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

YOLOv7改进实战 | 更换轻量化主干网络Backbone(一)之Ghostnet

前言 轻量化网络设计是一种针对移动设备等资源受限环境的深度学习模型设计方法。下面是一些常见的轻量化网络设计方法: 网络剪枝:移除神经网络中冗余的连接和参数,以达到模型压缩和加速的目的。分组卷积:将卷积操作分解为若干个较小的卷积操作,并将它们分别作用于输入的不…

Netty常用类与接口

netty架构图 ServerBootstrap 、 Bootstrap ServerBootstrap &#xff1a;服务器的引导类&#xff0c;可以绑定服务器和端口&#xff0c;配置 Channel、ChannelHandler等。 Bootstrap&#xff1a;客户端的引导类。可以开启客户端&#xff0c;连接服务端的端口&#xff0c;配置…

矩阵系统功能介绍

数据大屏&#xff1a;监测读取后台数据 AI素材库&#xff1a;一键去水印功能 将视频做出自己的 AI智能文案&#xff1a;一键生成各种文案&#xff0c;解决文案编写困难的问题 视频剪辑&#xff1a;一键剪辑多个视频

vue3引入全局js

main.js中引入js&#xff0c;设置全局属性 m a p : a p p . c o n f i g . g l o b a l P r o p e r t i e s . map:app.config.globalProperties. map:app.config.globalProperties.map引入js对象 vue页面中使用。引入vue实例&#xff1a; import {getCurrentInstance} from “…

VS2022更换背景壁纸逐步图示教程

&#x1f984;个人主页:修修修也 ⚙️操作环境:Visual Studio 2022 目录 一.下载壁纸插件 二.更改自定义壁纸 三.调整壁纸布局 一.下载壁纸插件 因为更改自定义壁纸需要一个插件的辅助,所以我们要先下载一个小插件 首先,打开VS2022,点击"扩展"->"管理扩…

无人机电力巡检:国网安徽实际案例解析

在科技快速发展的今天&#xff0c;传统行业正在经历前所未有的转型。电力巡检&#xff0c;这一看似传统且乏味的任务&#xff0c;却因为无人机技术的介入而焕发新生。今天&#xff0c;让我们深入了解一个具体的案例&#xff0c;探索无人机如何革新电力巡检。 案例背景&#xff…

Postman —— postman的介绍和安装

Postman的介绍 Postman 是一款谷歌开发的接口测试工具,使API的调试与测试更加便捷。 它提供功能强大的 Web API & HTTP 请求调试。它能够发送任何类型的HTTP 请求 (GET, HEAD, POST, PUT..)&#xff0c;附带任何数量的参数 headers postman是一款支持http协议的接口调试与…

【试题020】C语言自减运算符例题

1.题目&#xff1a;设int a1&#xff0c;b6;&#xff0c;执行表达式--all(b8)后&#xff0c;a和b的值分别是 &#xff1f; 2.代码分析&#xff1a; #include <stdio.h> int main() {//设int a1&#xff0c;b6;执行表达式--all(b8)后&#xff0c;a和b的值分别是?int a …

【手写数字识别】CNN卷积神经网络入门案例

安装Anaconda 下载地址&#xff1a;https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 安装完成后&#xff0c;在CMD窗口 输入conda --help 查看是否安装成功 使用conda创建环境 conda create --name tf python3.7conda activate tf在 tf 环境中安装TensorFlow pip in…

基于SpringCloud实现房产销售平台的设计与实现项目【项目源码+论文说明】

摘要 信息技术的发展推动了管理系统的进步&#xff0c;目前各种行业都积极参与管理系统的建设工作。特别是疫情带来的影响&#xff0c;让传统行业逐渐认识到只有通过在线管理才能继续的发展。房产销售平台是为求租者提供房源必备的平台&#xff0c;如何找到一个好的房源是生活…

PostgreSQL数据库结合内网穿透实现公网远程连接本地

文章目录 前言1. 安装postgreSQL2. 本地连接postgreSQL3. Windows 安装 cpolar4. 配置postgreSQL公网地址5. 公网postgreSQL访问6. 固定连接公网地址7. postgreSQL固定地址连接测试 前言 PostgreSQL是一个功能非常强大的关系型数据库管理系统&#xff08;RDBMS&#xff09;,下…

某马机房预约系统 C++项目(一)

机房预约系统 1、项目介绍 本项目来源于哔哩哔哩 c机房预约系统&#xff0c;本系统采用文件存储。 2、项目流程图 3、创建新项目 首先&#xff0c;我们来新建一个新项目&#xff0c;创建一个.cpp文件 4、创建主菜单 功能描述&#xff1a; 提供设计主菜单&#xff0c;与用…

WGCNA分析教程五 | [更新版]

一边学习&#xff0c;一边总结&#xff0c;一边分享&#xff01; 往期WGCNA分析教程 WGCNA分析 | 全流程分析代码 | 代码一 WGCNA分析 | 全流程分析代码 | 代码二 WGCNA分析 | 全流程分析代码 | 代码四 关于WGCNA分析教程日常更新 学习无处不在&#xff0c;我们的教程会在…

zabbix监控nginx的状态页面

zabbix监控nginx的状态页面 文章目录 zabbix监控nginx的状态页面1.环境说明2.所涉及到的知识点3.在nginx主机上安装zabbix_agent4.开启nginx状态显示页面5.进入zabbix的web页面配置主机&#xff0c;监控项&#xff0c;触发器5.1.添加主机5.2.创建监控项5.3.创建触发器 1.环境说…

Android高版本读取沙盒目录apk解析安装失败解决方案

bug场景&#xff1a; 应用内升级下载apk完成后安装&#xff0c;vivo&#xff08;Android13&#xff09;手机会报解析包错误&#xff0c;7.0及以上的手机是没问题的。开始以为是v1,v2签名问题导致的&#xff0c;但是我用浏览器下载下来的安装包是能够正确安装的。排除v1,v2签名的…

蓝桥杯(刷题统计,特别数的和 C++)

思路&#xff1a; 1、这题很简单&#xff0c;分两种情况累加和 &#xff0c;&#xff08;day%60||day%70&#xff09;即周六周天加上b&#xff0c;其它时候加上a。 2、注意的点在于数据可能达到&#xff0c;所以数据类型首先要开long long。 3、因为数据达到&#xff0c;所以直…

上海市通过区块链技术攻关 构建数字经济可信安全技术底座

日前&#xff0c;上海市印发《上海区块链关键技术攻关专项行动方案&#xff08;2023—2025年&#xff09;》&#xff08;以下简称《行动方案》&#xff09;&#xff0c;提出到2025年&#xff0c;在区块链体系安全、密码算法等基础理论以及区块链专用处理器、智能合约、跨链、新…

Canvas系列绘制图片学习:绘制图片和渐变效果

我们现在已经可以绘制好多东西了&#xff0c;不过在实际开发中&#xff0c;绘制最多的当然是图片了&#xff0c;这章我们就讲讲图片的绘制。 绘制图片 绘制图片的API是drawImage&#xff0c;它的参数有三种情况&#xff1a; // 将图片绘制在canvas的(dX, dY)坐标处 context.…

搭建react项目

一、环境准备 1、安装node 官网下载安装&#xff1a;https://nodejs.org/en 注&#xff1a; npm5.2以后&#xff0c;安装node会自动安装npm和npx 2、安装webpack npm install -g webpack3、安装create-react-app npm install -g create-react-app二、创建react项目 1、初…

宏offsetof的使用及其模拟实现

使用宏offsetof的时候需要包含<stddef.h>这个头文件。 宏offsetof有两个参数&#xff0c;第一个参数是结构体类型&#xff0c;第二个参数是结构体成员&#xff0c;计算的是结构体成员相较于结构体起始位置的偏移量&#xff0c;我们来看一个例子&#xff1a; 在这个例子中…