blob: 96d4cb24cf40ffa9193455ea41df9a1e0c1d8268 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
from gi.repository import Gtk
from gi.repository import Gdk
class PyApp(Gtk.Window):
def __init__(self):
super(PyApp, self).__init__()
self.set_title('Entrada de Texto')
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
self.set_size_request(250, 150)
def entry_cb(widget, event):
if Gdk.keyval_name(event.keyval) == 'Return':
print widget.get_text()
entry = Gtk.Entry()
entry.connect('key_press_event', entry_cb)
entry.show()
fixed = Gtk.Fixed()
fixed.put(entry, 20, 30)
fixed.show()
self.add(fixed)
self.show()
self.connect('destroy', Gtk.main_quit)
PyApp()
Gtk.main()
|