程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python implements the Windows lock screen program and packages it into an exe file

編輯:Python

Python implements a simple function: Windows lock screen, and package it into an exe file for distribution.

(1) The lock screen program code is very simple:

from ctypes import *if __name__ == '__main__':user32 = windll.LoadLibrary('user32.dll')user32.LockWorkStation()

(2) Packaging.

Use pyinstaller.If the pyinstaller library is not installed in the current environment, pass

pip install pyinstaller

Install.After the installation is complete, the program code file of the packager entry:

The program code file where the pyinstaller main entry is located.py

If successful, a /dist folder will be generated under the project, and a folder corresponding to the file name of the corresponding code program will be generated under the folder, and the same program file name.exe inside is the final packaged executable file.


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved