Re: can't run python gui with Tkinter

  • From: Jim Dunleavy <jim.dunleavy@xxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 15 Feb 2008 15:00:51 +0000

Hi Jaffar,

You're missing a colon there; it should read:
def __init__(self, master):

HTH

--Jim

----- Original Message ----- 
From: Jaffar@xxxxxxxxxxxxx 
To: programmingblind@xxxxxxxxxxxxx 
Sent: Friday, February 15, 2008 5:58 AM
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()

----------------------------------------------------------------------------
"Information in this email (including attachments) is confidential.  
It is intended for receipt and consideration only by the intended recipient.
If you are not an addressee or intended recipient, any use, dissemination,
distribution, disclosure, publication or copying of information contained in
this email is strictly prohibited.  Opinions expressed in this email may be
personal to the author and are not necessarily the opinions of the HSE.

If this email has been received by you in error we would be grateful if you 
could immediately notify the ICT Service Desk by telephone at +353 1 6352757 
or by email to service.desk@xxxxxxxxxxxx and thereafter delete this
e-mail from your system"
----------------------------------------------------------------------------

Other related posts: