class object using widget

2008-02-20 Thread asit
from Tkinter import *  # get widget classes
from tkMessageBox import askokcancel   # get canned std dialog

class Quitter(Frame):  # subclass our GUI
def __init__(self, parent=None):   # constructor method
Frame.__init__(self, parent)
self.pack()
widget = Button(self, text='Quit', command=self.quit)
widget.pack(side=LEFT)
def quit(self):
ans = askokcancel('Verify exit', Really quit?)
if ans: Frame.quit(self)

if __name__ == '__main__':  Quitter().mainloop()

In the above program, why the error comes ??
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class object using widget

2008-02-20 Thread Jeff Schwab
asit wrote:
 from Tkinter import *  # get widget classes
 from tkMessageBox import askokcancel   # get canned std dialog
 
 class Quitter(Frame):  # subclass our GUI
 def __init__(self, parent=None):   # constructor method
 Frame.__init__(self, parent)
 self.pack()
 widget = Button(self, text='Quit', command=self.quit)
 widget.pack(side=LEFT)
 def quit(self):
 ans = askokcancel('Verify exit', Really quit?)
 if ans: Frame.quit(self)
 
 if __name__ == '__main__':  Quitter().mainloop()
 
 In the above program, why the error comes ??

What error?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class object using widget

2008-02-20 Thread jim-on-linux
On Wednesday 20 February 2008 13:16, you 
wrote:
 from Tkinter import * 
 # get widget classes from tkMessageBox
 import askokcancel   # get canned
 std dialog

 class Quitter(Frame): 
 # subclass our GUI def __init__(self,
 parent=None):   # constructor
 method Frame.__init__(self, parent)
 self.pack()
 widget = Button(self, text='Quit',
 command=self.quit) widget.pack(side=LEFT)
 def quit(self):
 ans = askokcancel('Verify exit',
 Really quit?) if ans: Frame.quit(self)

 if __name__ == '__main__': 
 Quitter().mainloop()

 In the above program, why the error comes
 ??


This example works.
I only used carriage return and spacebar for 
formatting.

You are using '\xc2' whatever that 
represents, I'm not sure.  But if you 
carriage return at the end of each line then 
delete until the next line comes to the 
cursor then use only space bar and carriage 
return (Enter) to format you will fix it.
Or copy below and paste into your file.

jim-on-linux
http://www.inqvista.com

from Tkinter import *
from tkMessageBox import askokcancel

class Quitter (Frame):
 # subclass our GUI
def __init__(self, parent=None):
 # constructor method
 Frame.__init__(self, parent)
 self.pack()
 widget = Button(self, text='Quit', 
command=self.quit)
 widget.pack(side=LEFT)
def quit(self):
ans = askokcancel('Verify exit', 
Really quit?)
if ans: Frame.quit(self)

if __name__ == '__main__':
Quitter().mainloop()
-- 
http://mail.python.org/mailman/listinfo/python-list