我需要一个使用Tkinter模块创建静态(不可调整大小)窗口的Python脚本.
我有一个非常简单的Tkinter脚本,但我不希望它可以调整大小.如何防止Tkinter窗口可调整大小?老实说,我不知道该怎么做.
这是我的脚本:
from tkinter import *
import ctypes, os
def callback():
active.set(False)
quitButton.destroy()
JustGo = Button(root, text=" Keep Going!", command= lambda: KeepGoing())
JustGo.pack()
JustGo.place(x=150, y=110)
#root.destroy() # Uncomment this to close the window
def sleep():
if not active.get(): return
root.after(1000, sleep)
timeLeft.set(timeLeft.get()-1)
timeOutLabel['text'] = "Time Left: " + str(timeLeft.get()) #Update the label
if timeLeft.get() == 0: #sleep if timeLeft = 0
os.system("Powercfg -H OFF")
os.system("rundll32.exe powrprof.dll,SetSuspendState 0,1,0")
def KeepGoing():
active.set(True)
sleep()
quitButton1 = Button(root, text="do not sleep!", command=callback)
quitButton1.pack() …Run Code Online (Sandbox Code Playgroud) 如何使用 python 脚本使计算机休眠?
它必须是sleep,而不是 hibernate 或其他任何东西。
我尝试使用,cmd但没有睡眠命令,或者我没有找到。