def __init__(self, parent=None, **options): Frame.__init__(self, parent, **options) self.pack() Label(self, text='按钮组', font=('times', 16, 'bold')).pack() for (key, value) in demos.items(): Button(self, text=key, command=value).pack(side=TOP, fill=BOTH) Quitter(self).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None): Frame.__init__(self, parent) self.pack( ) Label(self, text="Basic demos").pack( ) for (key, value) in demos.items( ): Button(self, text=key, command=value).pack(side=TOP, fill=BOTH) Quitter(self).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None, **options): Frame.__init__(self, parent, **options) self.pack() Label(self, text='Basic demos').pack() for (key, value) in demos.items(): Button(self, text=key, command=value).pack(side=TOP, fill=BOTH) Quitter(self).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None, **config): Frame.__init__(self, parent, **config) self.pack() Label(self, text='basic demo').pack() for key, value in demos.items(): callb = (lambda key=key: self.printit(key)) Button(self, text=key, command=callb).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None): Frame.__init__(self, parent) self.pack() for (key, value) in demos.items(): func = (lambda self=self, name=key: self.printit(name)) Button(self, text=key, command=func).pack(side=TOP, fill=BOTH) Quitter(self).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None, **options): Frame.__init__(self, parent, **options) self.pack() Label(self, text='Demos').pack() for (key, value) in demos.items(): Button(self, text=key, command=value).pack(side=TOP, fill=BOTH) Quitter(self).pack(side=TOP, fill=BOTH)
def __init__(self, master=None, cnf={}, **kw): super(Demo, self).__init__(master, cnf={}, **kw) self.pack() Label(master=self, text='Basic demos').pack() for (key, value) in demos.items(): Button(master=self, text=key, command=value).pack(side=TOP, fill=BOTH) Quitter(master=self).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None): Frame.__init__(self, parent) self.pack() Label(self, text='Basic Demos').pack() for (key, value) in demos.items(): func = (lambda: key=key: self.printit(key)) Button(self, text=key, command=func).pack(side=TOP, fill=BOTH) Quitter(self).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None): Frame.__init__(self, parent) self.pack() # Label(self, text="Basic demos").pack() for (key, value) in demos.items(): Button(self, text=key, command=value).pack(side=TOP, fill=BOTH) Quitter(self).pack(side=TOP, fill=BOTH) Label(self, text="Basic demos").pack()
def __init__(self, parent=None, **configs): Frame.__init__(self, parent, **configs) self.pack() Label(self, text='Basic Demos').pack() for(key, cmd) in demos.items(): fuc = (lambda handler=self.printRet, name=key: handler(name)) # Button(self, text=key, command=cmd).pack(side=TOP, fill=BOTH) Button(self, text=key, command=fuc).pack(side=TOP, fill=BOTH)
def __init__(self,parent=None,**options): Frame.__init__(self,parent,**options) self.pack() Label(self,text="Basic Demos").pack() for(key,value) in demos.items(): func = (lambda key=key:self.printit(key)) Button(self,text=key,command=func).pack(side=TOP,fill=BOTH) Quitter(self).pack(side=TOP,fill=BOTH)
def __init__(self, parent=None): Frame.__init__(self, parent) self.pack() Label(self, text="Radio demos").pack(side=TOP) self.var = StringVar() for (key, value) in demos.items(): Radiobutton(self, text=key, command=self.onPress, variable=self.var, value=key).pack(anchor=NW) Button(self, text="State", command=self.report).pack(fill=X) Quitter(self).pack(fill=X)
def __init__(self, parent=None, **options): Frame.__init__(self, parent, **options) self.pack() Label(self, text="Basic demos").pack() # label on top of window for (key, value ) in demos.items(): # builds the list of buttons from 'demos' Button(self, text=key, command=value).pack(side=TOP, fill=BOTH) Quitter(self).pack(side=TOP, fill=BOTH) # separate quit button from import
def __init__(self, parent=None, **options): Frame.__init__(self, parent, **options) self.pack() Label(self, text="Basic demos").pack() for (key, value) in demos.items(): # es un diccionario => los botones apareceran no siempre en e mismo orden aleatorio Button(self, text=key, command=value).pack(side=TOP, fill=BOTH) # a la coleccion de botones anterior añade el boton quitter del ejemplo 8-7 Quitter(self).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None): Frame.__init__(self, parent) self.pack() Label(self, text="Radio demos").pack(side=TOP) self.var = StringVar() for (key, value) in demos.items(): Radiobutton(self, text=key, command=self.onPress, variable=self.var, value=key).pack(anchor=NW) Button(self, text='State', command=self.report).pack(fill=X) Quitter(self).pack(fill=X)
def __init__(self, parent=None, **options): Frame.__init__(self, parent, **options) self.pack() Label(self, text="Basic demos").pack() for (key, value) in demos.items( ): # es un diccionario => los botones apareceran no siempre en e mismo orden aleatorio Button(self, text=key, command=value).pack(side=TOP, fill=BOTH) # a la coleccion de botones anterior añade el boton quitter del ejemplo 8-7 Quitter(self).pack(side=TOP, fill=BOTH)
def __init__(self, parent=None, **config): Frame.__init__(self, parent, **config) self.pack() Label(self, text='basic demo').pack() for key, value in demos.items(): Button(self, text=key, command=value).pack(side=TOP, fill=BOTH)