#-*- coding:utf-8 -*-
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
from ctypes import *
from time import sleep
import time
import threading
import PyQt4
from PyQt4.Qt import pyqtSignal
from win32con import *
key = 50
hotkeyId = 3
xdesktop=0
keyhot={"hokeyflag":True}
hokeyflag=True
PADDING=4
dictEnum={'UP':0,'DOWN':1,'LEFT':2,'RIGHT':3,'LEFTTOP':4,'LEFTBOTTOM':5,'RIGHTTOP':6,'RIGHTBOTTOM':7,'NONE':8}
dictRect={'width':200,'height':300}
class POINT(Structure):
_fields_=[("x",c_ulong),("y",c_ulong)]
class MSG(Structure):
_fields_ = [('hwnd', c_int),
('message', c_uint),
('wParam', c_int),
('lParam', c_int),
('time', c_int),
('pt', POINT)]
if not windll.user32.RegisterHotKey(None,hotkeyId,MOD_ALT,key):
sys.exit("Can't Rigister Hotkey")
class threadPoint(QThread):
mysignal=pyqtSignal(int)
def __init__(self,tyPoint,tyHeight,parent=None):
super(threadPoint,self).__init__(parent)
self.type=tyPoint
self.height=tyHeight
def run(self):
while True:
orig=POINT()
windll.user32.GetCursorPos(byref(orig))
if orig.y in range(self.height,self.height+dictRect['height']):
if orig.x in range(-5,5) and self.type=="Left":
self.mysignal.emit(1)
break
elif orig.x in range(xdesktop-5,xdesktop+5) and self.type=="Right":
self.mysignal.emit(2)
break
elif orig.x in range(self.height,self.height+dictRect['width']):
if orig.y in range(-5,5) and self.type=="Top":
self.mysignal.emit(3)
break
time.sleep(0.2)
self.deleteLater()
class Myqq(QWidget):
def __init__(self,parent=None):
super(Myqq,self).__init__(p
pyqt实现自定义窗口拖动大小,到桌面边框自动影藏
最新推荐文章于 2023-06-02 20:58:01 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)