Files
2019-01-02 14:53:58 -05:00

44 lines
1.3 KiB
Python

#!/usr/bin/python3
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import os
class AppWindow(Gtk.ApplicationWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.set_border_width(10)
prompt_str = "What is the password for " + os.getlogin() + "?"
question = Gtk.Label(prompt_str)
label = Gtk.Label("Password:")
passwd = Gtk.Entry()
passwd.set_visibility(False)
passwd.set_invisible_char("*")
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
hbox.pack_start(label, False, False, 5)
hbox.pack_start(passwd, False, False, 5)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
vbox.pack_start(question, False, False, 0)
vbox.pack_start(hbox, False, False, 0)
self.add(vbox)
class Application(Gtk.Application):
def __init__(self, *args, **kwargs):
super().__init__(*args, application_id="org.example.myapp",
**kwargs)
self.window = None
def do_activate(self):
if not self.window:
self.window = AppWindow(application=self, title="Password")
self.window.show_all()
self.window.present()
if __name__ == "__main__":
app = Application()
app.run(sys.argv)