Curso de Programación en Python/Input-8
Ir a la navegación
Ir a la búsqueda
Input-8.py
1 #!/usr/bin/python3
2 #-*-coding: utf-8 -*-
3
4 from tkinter import *
5
6 class MyDialog:
7 def __init__( self, parent ):
8 top = self.top = Toplevel( parent )
9 Label( top, text="Valor" ).pack()
10 self.e = Entry( top )
11 self.e.pack( padx=5 )
12 b = Button( top, text="Listo", command=self.ok )
13 b.pack( pady=5 )
14
15 def ok( self ):
16 print( "El valor es:", self.e.get() )
17 self.top.destroy()
18
19 root = Tk()
20 Button( root, text="Hola!" ).pack()
21 root.update()
22
23 d = MyDialog( root )
24
25 root.wait_window( d.top )