如何使一个tkinterButton
暂时完全填满整个gui,然后在按下所说的按钮后,返回到先前的状态。你知道吗
我尝试将按钮设置为我的“最高级别”框架,并使用扩展和填充配置设置,这使得Button
非常大,但最终它只填充了我的gui的底部1/3。你知道吗
... other instantiations...
#Initialization of button in gui as whole
toggleBacklightButton = Button(patternOptionFrame,text="Screen Light",
font=('calibri',(10)),relief="raised",
command=toggleBacklight)
toggleBacklightButton.grid(row=0,column=3)
... other code...
#Function that the button press calls.
def toggleBacklight():
global backlight_toggle
backlight_toggle = not backlight_toggle
if backlight_toggle is True:
# Button should be as it was when instantiated AND back light
# is on / all other ~20 widgets are also where they belong.
os.system(
"sudo sh -c 'echo \"0\" > /sys/class/backlight/rpi_backlight/bl_power'")
else:
# Button should fill entire screen for ease of access when
# screen is black / all other ~20 widgets are hidden.
os.system(
"sudo sh -c 'echo \"1\" > /sys/class/backlight/rpi_backlight/bl_power'")
... other functions...
按钮切换我的触摸屏显示,但是,我不知道如何使它占据整个屏幕时,屏幕背光关闭。你知道吗
Tkinter通常不允许小部件重叠-使你的按钮变大只会将其他小部件推开,实际上它永远不会覆盖它们。在极其罕见的情况下,如果您希望重叠,则只有
.place()
几何体管理器可以这样做。将按钮设置为窗口本身的直接子级,然后执行以下操作:要让它占据窗户,那么:
为了摆脱它。你知道吗
如果您想使用重叠的小部件,那么就在一个框架内构建所有内容,并将按钮放置在框架的同一网格位置上。你知道吗
像这样:
相关问题 更多 >
编程相关推荐