python控制窗口移动(画圆)

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)

 

posted @ 2018-06-21 10:33  睡觉了嘛  阅读(2080)  评论(0编辑  收藏  举报