Help Pliz ! stuck on page 4 of tutorial

Logan logan at phreaker.nospam
Fri Nov 21 20:47:53 EST 2003


On Fri, 21 Nov 2003 16:10:11 -0800, Adolfo wrote:

> Hello everyone, I am a newbie starting Fredrik Lundh .pdf tutorial. Running W2000.
> 
> I am stuck in page four "Hello Again" program:
> When I try running it, it shows the root Python window very fast and 
> dissapears. The intended Tk window with buttons: either does not 
> show, or dissapears fast before I can tell it is there. The first 
> program on the tutorial did run fine.
> 
> Here's the program as shown on the tutorial:

You had a lot of typos in your code; 
here's a corrected version which should work. 

HTH, Thomas.


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()

-- 
mailto: logan at phreaker(NoSpam).net





More information about the Python-list mailing list