RE: can't run python gui with Tkinter

  • From: "Sean Mealin" <seanpm@xxxxxxxxxxxx>
  • To: <jaffar@xxxxxxxxxxxxx>, <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 15 Feb 2008 16:17:26 -0500

You must indent it. This may just be my PAC-MATE being stupid again, but
it doesn't look as if you indented the def statement. So the def must
have one level of indentation, let's say two spaces, then the body must
be indented more, let's say four spaces.  Also I think you are missing a
colon (:).

HTH
Sean

-----Original Message-----
From: "Jaffar@xxxxxxxxxxxxx" <jaffar@xxxxxxxxxxxxx>
Sent: 02/15/08 00:59:00
To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
Subject: can't run python gui with Tkinter

Hi all.  Need some advice from the python experts on the list.  I am
learning Tkinter gui programming with python.  I am trying to build a
hello world program with text messages and buttons.  I used Ed sharp to
write the code and used the py dent facility that came with this
fantastic editor.  However, I always get an indentation error on the
third line of the code whose  content is:
def __init__(self, master)
when i try to run it.  Here is the whole code.  Any help will be
appreciated.
Cheers!
Code below:
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()

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: