Add components to a dialog : Dialog : GUI Tk PYTHON examples


PYTHON examples » GUI Tk » Dialog »

 

Add components to a dialog


Add components to a dialog
 
from Tkinter import *

class MyDialog:
    def __init__(self, parent):

        top = self.top = Toplevel(parent)

        Label(top, text="Value").pack()

        self.e = Entry(top)
        self.e.pack(padx=5)

        b = Button(top, text="OK", command=self.ok)
        b.pack(pady=5)

    def ok(self):

        print "value is", self.e.get()

        self.top.destroy()


root = Tk()
#Button(root, text="Hello!").pack()
#root.update()

d = MyDialog(root)

root.wait_window(d.top)

           
         
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo GUI Tk
» Dialog