锁鼠标键盘
#coding=utf-8
from ctypes import *
import time
import os,pygame,threading
windll.user32.BlockInput("true")
windll.user32.SetCursorPos(100, 100) #该函数把光标移到屏幕的指定位置
pygame.init()
hide.mouse.set_visible(False)
time.sleep(10)
windll.user32.BlockInput(0)
有图像覆盖锁屏
import tkinter as tk
class App():
def __init__(self):
self.root = tk.Tk()
self.root.attributes('-fullscreen', True)
self.root.configure(background='red')
self.root.bind('<F1>', self.opennote)
self.root.bind('<F2>', self.closenote)
self.root.bind('<F3>', self.quit)
l = tk.Label(text="some text here")
l.pack()
self.root.mainloop()
def opennote(self, event):
self.n = tk.Text(self.root, background='blue')
self.n.pack()
def closenote(self, event):
self.n.destroy()
def quit(self, event):
self.root.destroy()
App()
from tkinter import *
import os,pygame,threading
root=Tk()
root.title("")
root.attributes("-transparentcolor","red") #设置透明色,blue可替换其他颜色
Label(root,bg="red").pack(fill="both",expand=True)#显示图像或者文字
root.attributes("-fullscreen",True) #窗口最大化
root2=Toplevel(root) #创建子窗体
root2.title("")#标题
root2.attributes("-transparentcolor","red")#设置透明色,blue可替换其他颜色
Label(root2,bg="red").pack(fill="both",expand=True)#显示图像或者文字
root2.attributes("-fullscreen",True)#窗口最大化
root2.attributes("-topmost",True)#使窗口保持处于顶层
root2.deiconify() #还原窗口
root.protocol("WM_DELETE_WINDOW",lambda:None) #创建销毁窗口
root2.protocol("WM_DELETE_WINDOW",lambda:os.system("shutdown -s -t 1")) #关机销毁窗口
def pygamemain():
pygame.init() #初始化
screen=pygame.display.set_mode((30,30)) #创建Surface屏幕对象
pygame.display.set_caption("")
pygame.event.set_grab(True)
while True:
for event in pygame.event.get():
if event.type==pygame.MOUSEBUTTONDOWN:
pygame.event.set_grab(True)
elif event.type==pygame.KEYDOWN:
pygame.event.set_grab(True)
pygame.display.flip()
threading.Thread(target=pygamemain).start()
mainloop()
隐藏下边栏
import win32gui
fd = win32gui.FindWindow("Shell_TrayWnd",None)
win32gui.ShowWindow(fd,0)