forked from buckyroberts/Source-Code-from-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11_entry.py
More file actions
39 lines (29 loc) · 1.05 KB
/
11_entry.py
File metadata and controls
39 lines (29 loc) · 1.05 KB
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
32
33
34
35
36
37
38
39
from gi.repository import Gtk
class UserInput(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Messenger 2.0")
self.set_border_width(10)
self.set_size_request(200, 100)
# Layout
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.add(vbox)
# Username
self.username = Gtk.Entry()
self.username.set_text("Username")
vbox.pack_start(self.username, True, True, 0)
# Password
self.password = Gtk.Entry()
self.password.set_text("Password")
self.password.set_visibility(False)
vbox.pack_start(self.password, True, True, 0)
# Sign In Button
self.button = Gtk.Button(label="Sign In")
self.button.connect("clicked", self.sign_in)
vbox.pack_start(self.button, True, True, 0)
def sign_in(self, widget):
print(self.username.get_text())
print(self.password.get_text())
window = UserInput()
window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()