#coding=utf-8 from ctypes import * import time import os,pygame,threading windll.user32.BlockInpu

锁鼠标键盘

#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)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值