本文整理汇总了Python中Tkinter.Frame.grid_remove方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.grid_remove方法的具体用法?Python Frame.grid_remove怎么用?Python Frame.grid_remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Frame
的用法示例。
在下文中一共展示了Frame.grid_remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MyFrame
# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import grid_remove [as 别名]
class MyFrame(Frame):
def __init__(self, parent, controller):
Frame.__init__(self, parent, background="white")
self.parent = parent
self.controller = controller #GUIController(controllable)
self.controllable = controller.controllable
self.initUI()
def initUI(self):
self.parent.title("Simple")
self.pack(fill=BOTH, expand=1)
self.fireFrame = Frame(self, background="lightgrey", height = 20)
self.fireFrame.pack(fill=X, side=BOTTOM)
leftFrame = Frame(self, background="lightgrey" )
leftFrame.pack(fill=Y, side = LEFT)
rightFrame = Frame(self, background="lightgrey")
rightFrame.pack(fill=Y, side = RIGHT)
rightFill = Frame(rightFrame, background="lightgrey")
rightFill.pack(side=TOP )
centreFrame = Frame(self, background="lightgrey")
centreFrame.pack(fill=BOTH, expand=True)
clusterFrame = Frame(centreFrame, background="lightgrey", width = 80, height = 80)
clusterFrame.pack(pady = 60)
self.lights = []
self.lights.append( Frame(clusterFrame, width=20, height=20, background="darkgrey") )
self.lights[0].grid(row=0, column =0, padx = 10, pady = 10)
self.lights.append( Frame(clusterFrame, width=20, height=20, background="darkgrey") )
self.lights[1].grid(row=0, column =1, padx = 10, pady = 10)
self.lights.append( Frame(clusterFrame, width=20, height=20, background="darkgrey") )
self.lights[2].grid(row=0, column =2, padx = 10, pady = 10)
camera = Frame(clusterFrame, width=25, height=25, background = "black")
camera.grid(row=1, column =1, padx = 10, pady = 10)
self.lights.append( Frame(clusterFrame, width=20, height=20, background="darkgrey") )
self.lights[3].grid(row=2, column =0, padx = 10, pady = 10)
self.lights.append( Frame(clusterFrame, width=20, height=20, background="darkgrey") )
self.lights[4].grid(row=2, column =2, padx = 10, pady = 10)
self.cambuttons = Frame( clusterFrame, background="lightgrey")
self.cambuttons.grid( row = 3, column = 1)
accept = Button( self.cambuttons, text="Accept" , command= self.acceptButtonPress, width=5)
accept.pack()
reject = Button( self.cambuttons, text="Reject" , command= self.rejectButtonPress, width=5)
reject.pack()
fail = Button( self.cambuttons, text="Fail" , command= self.failButtonPress, width=5)
fail.pack()
self.cambuttons.grid_remove()
self.doorStateVar = StringVar()
self.doorStateVar.set('Closed');
doorSwitch = Tkinter.Checkbutton(leftFrame, text = "Door Closed", command = self.doorChange, onvalue = 'Closed', offvalue = 'Open', variable = self.doorStateVar)
doorSwitch.pack()
self.alarmRed = Frame(leftFrame, background='#A88', width=20, height=20)
self.alarmRed.pack(side=BOTTOM, padx = 10, pady = 10)
self.alarmGreen = Frame(leftFrame, background='#8A8', width=20, height=20)
self.alarmGreen.pack(side=BOTTOM, padx = 10, pady = 10)
userButton = Button(rightFrame, text = "Press", command = self.userButtonPress, padx = 20)
userButton.bind('<Button-1>', self.userButtonDown)
userButton.bind('<ButtonRelease-1>', self.userButtonUp)
userButton.pack(side=BOTTOM)
#self.pack(fill=BOTH, expand=1)
def acceptButtonPress(self):
self.controllable.acceptAuth()
def rejectButtonPress(self):
self.controllable.rejectAuth()
def failButtonPress(self):
self.controllable.failAuth()
def userButtonPress(self):
self.controllable.userButtonPress()
def userButtonUp(self,event):
self.controllable.userButtonUp()
def userButtonDown(self,event):
self.controllable.userButtonDown()
def doorChange(self):
if ( self.doorStateVar.get() == 'Open' ) :
self.controllable.doorOpen()
else :
self.controllable.doorClose()