global variables
Colin J. Williams
cjw at sympatico.ca
Tue Oct 2 19:57:31 EDT 2007
TheFlyingDutchman wrote:
> Does anyone know how the variables label and scale are recognized
> without a global statement or parameter, in the function resize() in
> this code:
>
>
>
> #!/usr/bin/env python
>
> from Tkinter import *
>
> def resize(ev=None):
> label.config(font='Helvetica -%d bold' % \
> scale.get())
>
>
> top = Tk()
> top.geometry('250x150')
>
> label = Label(top, text='Hello World!', <<<<<<
> font='Helvetica -12 bold')
> label.pack(fill=Y, expand=1)
>
> scale = Scale(top, from_=10, to=40, <<<<
> orient=HORIZONTAL, command=resize)
> scale.set(12)
> scale.pack(fill=X, expand=1)
>
> quit = Button(top, text='QUIT',
> command=top.quit, activeforeground='white',
> activebackground='red')
> quit.pack()
>
> mainloop()
>
label and scale are instances.
Colin W.
More information about the Python-list
mailing list