On 6/9/2010 1:13 PM, Dodo wrote:

import Tkinter as tk
from Tkconstants import *
import tkSimpleDialog

class MyDialog(tkSimpleDialog.Dialog):
def body(self, master):
prompt = "Hello from my custom dialog!\nAlthough with
something this simple i should have used tkMessageBox."
tk.Label(self, text=prompt).pack()

def validate(self):
print 'I need to put some code here, maybe'
return True

def apply(self):
print 'I need to put some code here, maybe'


class App(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
b=tk.Button(self, text='Show Dialog', command=self.showDialog)
b.pack(padx=5, pady=5)

def showDialog(self):
d = MyDialog(self)

if __name__ == '__main__':
app = App()
app.mainloop()

Could you please explain to me what's the big difference?

What Rick wrote is pretty standard and similar to the example in Lib Ref 24.1.2.2. A Simple Hello World Program and others you can find. It get the right things done in the right place, and just once.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to