小编IDK*_*ing的帖子

如何使Tkinter窗口不可调整大小?

我需要一个使用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)

static tkinter python-3.x

29
推荐指数
1
解决办法
3万
查看次数

如何使用python脚本使Windows 10计算机进入睡眠状态?

如何使用 python 脚本使计算机休眠?

它必须是sleep,而不是 hibernate 或其他任何东西。

我尝试使用,cmd但没有睡眠命令,或者我没有找到。

python sleep windows-10

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

python ×1

python-3.x ×1

sleep ×1

static ×1

tkinter ×1

windows-10 ×1