tkinter doubt

Thomas Jollans thomas at jollans.com
Thu Jun 10 03:48:31 EDT 2010


On 06/10/2010 08:50 AM, madhuri vio wrote:
> # File: hello2.py
> 
> from Tkinter import *
> 
> class App:
> 
>     def __init__(self, master):
> 
>         frame = Frame(master)
>         frame.pack()
> 
>         self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)
> 
>         self.button.pack(side=LEFT)
> 
>         self.hi_there = Button(frame, text="Hello", command=self.say_hi)
>         self.hi_there.pack(side=LEFT)
> 
>     def say_hi(self):
>         print "hi there, everyone!"
> 
> 
> root = Tk()
> 
> app = App(root)
> 
> root.mainloop()
> 
> in this program i wanted to  get a clear idea about this
> 
> 
> def __init__(self, master):
> 
>         frame = Frame(master)
> 
>         frame.pack()
> 
>         self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)
>         self.button.pack(side=LEFT)
> 
>         self.hi_there = Button(frame, text="Hello", command=self.say_hi)
> 
>         self.hi_there.pack(side=LEFT)
> 
> what is _init_...self and master...
read up on object-orientation with Python

> where did frame and button come from...
frame and self.button were set. Frame and Button were probably imported.

> kindly reply...awaiting
Please read
  http://www.catb.org/~esr/faqs/smart-questions.html
Even if you didn't mean to send this to the mailing list (in which case,
you shouldn't have...), you should *still* read it. Whoever you were
addressing would *certainly* appreciate it if you took this to heart.

I repeat: Please read
  http://www.catb.org/~esr/faqs/smart-questions.html
You have been asked to do so before and I cannot believe that you did it.

> -- 
> madhuri :)
> 

PS: you addressed python-list-request at python.org as well. That's the
address of the software that takes care of subscribing and unsubscribing
people. No use writing questions there.



More information about the Python-list mailing list