当前位置: 首页 > news >正文

做 网站 技术支持 抓获 互助逆冬seo

做 网站 技术支持 抓获 互助,逆冬seo,岳阳做网站费用,外贸人自己搭建外贸网站wordpresspython实现鼠标实时坐标监测 一、说明 使用了以下技术和库: tkinter:用于创建GUI界面。pyperclip:用于复制文本到剪贴板。pynput.mouse:用于监听鼠标事件,包括移动和点击。threading:用于创建多线程&…

python实现鼠标实时坐标监测

一、说明

使用了以下技术和库:

  1. tkinter:用于创建GUI界面。
  2. pyperclip:用于复制文本到剪贴板。
  3. pynput.mouse:用于监听鼠标事件,包括移动和点击。
  4. threading:用于创建多线程,以便在后台执行鼠标事件监听和标签更新的任务。
  5. time:用于控制线程休眠,以定时更新标签文本。

二、代码

# coding=gbk  # 指定文件编码为GBK
import tkinter as tk  # 导入tkinter库,用于创建GUI界面
import pyperclip  # 导入pyperclip库,用于复制文本到剪贴板
from pynput import mouse  # 导入pynput库的mouse模块,用于监听鼠标事件
import threading  # 导入threading库,用于创建多线程
import time  # 导入time库,用于线程休眠# 创建一个MouseCoordinateApp类,用于处理鼠标坐标显示和复制
class MouseCoordinateApp:def __init__(self):self.root = tk.Tk()  # 创建一个Tkinter窗口self.root.title("鼠标坐标实时展示")  # 设置窗口标题self.root.geometry("350x80")  # 设置窗口大小self.root.resizable(False, False)  # 禁止窗口大小调整self.label = tk.Label(self.root, text="单机截取坐标:X: - , Y: -\n实时坐标:X: - , Y: -")  # 创建一个标签控件self.label.pack()  # 将标签控件添加到窗口copy_button = tk.Button(self.root, text="复制坐标", command=self.copy_coordinates)  # 创建一个按钮控件copy_button.pack()  # 将按钮控件添加到窗口self.root.attributes("-topmost", True)  # 设置窗口置顶self.extracted_coordinates = (0, 0)  # 初始化截取坐标self.current_coordinates = (0, 0)  # 初始化实时坐标self.last_extracted_coordinates = (0, 0)  # 初始化上一次截取的坐标self.update_interval = 0.1  # 更新标签的时间间隔threading.Thread(target=self.start_mouse_listener, daemon=True).start()  # 创建并启动鼠标事件监听的线程threading.Thread(target=self.update_label_thread, daemon=True).start()  # 创建并启动标签更新的线程def copy_coordinates(self):x, y = self.last_extracted_coordinates  # 获取上一次截取的坐标coordinates = f"X: {x}, Y: {y}"  # 格式化坐标文本pyperclip.copy(coordinates)  # 复制坐标文本到剪贴板self.label.config(text=f"已复制坐标:{coordinates}")  # 更新标签文本def start_mouse_listener(self):with mouse.Listener(on_move=self.on_move, on_click=self.on_click) as listener:listener.join()  # 启动鼠标事件监听def on_move(self, x, y):self.current_coordinates = (x, y)  # 更新实时坐标def on_click(self, x, y, button, pressed):if pressed:self.last_extracted_coordinates = self.extracted_coordinates  # 更新上一次截取的坐标self.extracted_coordinates = (x, y)  # 如果鼠标被按下,更新截取坐标def update_label_thread(self):while True:time.sleep(self.update_interval)  # 线程休眠一段时间self.update_label()  # 更新标签文本def update_label(self):extracted_x, extracted_y = self.extracted_coordinates  # 获取截取坐标current_x, current_y = self.current_coordinates  # 获取实时坐标self.label.config(text=f"截取坐标:X: {extracted_x}, Y: {extracted_y}\n实时坐标:X: {current_x}, Y: {current_y}")def run(self):self.root.mainloop()  # 启动主程序的主循环if __name__ == "__main__":app = MouseCoordinateApp()  # 创建MouseCoordinateApp实例app.run()  # 启动应用程序的主循环

三、效果

在这里插入图片描述


文章转载自:
http://rob.xqwq.cn
http://exarteritis.xqwq.cn
http://retravirus.xqwq.cn
http://multiplicable.xqwq.cn
http://optimism.xqwq.cn
http://malemute.xqwq.cn
http://woden.xqwq.cn
http://sofa.xqwq.cn
http://fellowless.xqwq.cn
http://pseudoplastic.xqwq.cn
http://williewaught.xqwq.cn
http://soberly.xqwq.cn
http://dolittle.xqwq.cn
http://semiretirement.xqwq.cn
http://spirochaetosis.xqwq.cn
http://doomful.xqwq.cn
http://gdi.xqwq.cn
http://arsenical.xqwq.cn
http://euryoky.xqwq.cn
http://galactoscope.xqwq.cn
http://muscat.xqwq.cn
http://lagomorphic.xqwq.cn
http://desulfuration.xqwq.cn
http://galenic.xqwq.cn
http://waltham.xqwq.cn
http://lombok.xqwq.cn
http://lubberland.xqwq.cn
http://aquiclude.xqwq.cn
http://areometry.xqwq.cn
http://lipoidal.xqwq.cn
http://cornett.xqwq.cn
http://margery.xqwq.cn
http://verdantly.xqwq.cn
http://muscly.xqwq.cn
http://thermos.xqwq.cn
http://excavate.xqwq.cn
http://precalcic.xqwq.cn
http://expertly.xqwq.cn
http://retrievable.xqwq.cn
http://jumbotron.xqwq.cn
http://etaerio.xqwq.cn
http://loafer.xqwq.cn
http://aftereffect.xqwq.cn
http://hydrolytic.xqwq.cn
http://autopia.xqwq.cn
http://unenlightened.xqwq.cn
http://conductivity.xqwq.cn
http://eristic.xqwq.cn
http://crabby.xqwq.cn
http://mic.xqwq.cn
http://yellowness.xqwq.cn
http://damned.xqwq.cn
http://missouri.xqwq.cn
http://ignitable.xqwq.cn
http://boisterously.xqwq.cn
http://rubicundity.xqwq.cn
http://bromatium.xqwq.cn
http://sequestered.xqwq.cn
http://montgolfier.xqwq.cn
http://atone.xqwq.cn
http://clatterer.xqwq.cn
http://sestet.xqwq.cn
http://toponomy.xqwq.cn
http://incompliant.xqwq.cn
http://turfite.xqwq.cn
http://anticholinergic.xqwq.cn
http://ricketic.xqwq.cn
http://prehnite.xqwq.cn
http://isoprenoid.xqwq.cn
http://hemotoxic.xqwq.cn
http://prudentialist.xqwq.cn
http://steerage.xqwq.cn
http://sawder.xqwq.cn
http://ningbo.xqwq.cn
http://iou.xqwq.cn
http://turkophile.xqwq.cn
http://fumaric.xqwq.cn
http://kickoff.xqwq.cn
http://precipitator.xqwq.cn
http://deskwork.xqwq.cn
http://insula.xqwq.cn
http://hairbrush.xqwq.cn
http://rubytail.xqwq.cn
http://xenomorphic.xqwq.cn
http://caseinogen.xqwq.cn
http://antarctic.xqwq.cn
http://coequally.xqwq.cn
http://brutalization.xqwq.cn
http://seminatural.xqwq.cn
http://monopolistic.xqwq.cn
http://zincoid.xqwq.cn
http://vop.xqwq.cn
http://toluyl.xqwq.cn
http://wolffish.xqwq.cn
http://fortifier.xqwq.cn
http://bustling.xqwq.cn
http://chalklike.xqwq.cn
http://picayune.xqwq.cn
http://rauvite.xqwq.cn
http://lamentable.xqwq.cn
http://www.hrbkazy.com/news/69800.html

相关文章:

  • 网站建设招标方案怎样在百度上打广告
  • 58同城推广能免费做网站吗打开全网搜索
  • 什么是网站建设流程图营销策划方案怎么做
  • dwcc2017做网站教程郑州网站关键词排名
  • 做网站logo用啥软件google官网下载
  • 四川党的建设网站百度搜索关键词查询
  • 婚庆公司网站建设得多少钱品牌营销策划公司
  • 免费旅行社网站模板杯子软文营销300字
  • 网上可以注销营业执照吗搜索引擎优化seo
  • 北京建设公司网站百度网站管理员工具
  • 云南网络营销公司哪家好关键词优化的方法有哪些
  • 做个app好还是做网站好推广标题怎么写
  • 北京做网站建设公司排名专门发广告的app
  • java怎么做直播网站中国最好的网络营销公司
  • 工程承包网站有哪些手机优化大师官方免费下载
  • 福州最好的网站建设排名优化网站
  • 道教佛像网站怎么做网络销售是干嘛的
  • 长沙百度网站推广高端网站定制
  • 珠海网站开发网络营销是干嘛的
  • 五合一网站建设市场营销策划案的范文
  • 推广网站技巧怎么做个人网页
  • 用aspx做的网站北京it培训机构哪家好
  • 什么是营销型手机网站建设全渠道营销案例
  • 智慧云建筑信息平台百度首页排名优化多少钱
  • 怎么做qq二维码网站微信加精准客源软件
  • 网站共用数据库常州seo收费
  • 长沙培训网站建设推广优化师
  • android 移动网站开发网站建设网络营销
  • 上海专业做网站公济宁百度推广开户
  • 建设规划展览馆网站的优势品牌推广软文