码迷,mamicode.com
首页 > 移动开发 > 详细

python控制窗口移动(轨迹为圆)

时间:2019-05-03 13:08:55      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:位置   控制   记事本   +=   移动   操作   0.00   color   cos   

 

需先打开一个无标题记事本,

import win32con
import win32gui
import time
import math
notepad = win32gui.FindWindow("Notepad","无标题 - 记事本")
while True:
    SE = 0.0  # 弧度
    while SE - 3.1415926535 *2 < 0.0000001: #浮点数运算存在误差
        time.sleep(0.1)
        SE += 0.1
        newx = int(400+400*math.cos(SE)) # 圆心加半径
        newy = int(400+400*math.sin(SE))  # 圆心加半径
        win32gui.SetWindowPos(notepad,  # 操作记事本
                              win32con.HWND_TOPMOST,
                              newx,  # x位置
                              newy,  # y位置
                              300,  # 宽
                              300,  # 高
                              win32con.SWP_SHOWWINDOW)

 

python控制窗口移动(轨迹为圆)

标签:位置   控制   记事本   +=   移动   操作   0.00   color   cos   

原文地址:https://www.cnblogs.com/sea-stream/p/10804820.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!