使用python调用锁定屏幕

Are*_*ski 5 python authentication ubuntu lockscreen

如何从python应用程序中调出锁定屏幕?我想应用程序为我这样做,而不是分别按Ctrl-Alt-L.

Ste*_*uch 5

对于Ubuntu:

os.popen('gnome-screensaver-command --lock')
Run Code Online (Sandbox Code Playgroud)

(来源)

对于Windows:

import ctypes
ctypes.windll.user32.LockWorkStation()
Run Code Online (Sandbox Code Playgroud)

(来源)