daily pastebin goal
54%
SHARE
TWEET

Untitled

a guest Feb 4th, 2016 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from gi.repository import Gtk
  2.  
  3. import base64
  4.  
  5. class classInputs(Gtk.Window):
  6.     def __init__(self):
  7.  
  8.         Gtk.Window.__init__(self, title="Inputs try window")
  9.         self.set_border_width(10)
  10.         self.set_size_request(200,100)
  11.  
  12.         # Layout
  13.         vertical_box = Gtk.Box(orientation = Gtk.Orientation.VERTICAL, spacing = 8)
  14.         self.add(vertical_box)
  15.  
  16.         #userName input
  17.         self.username = Gtk.Entry()
  18.         self.username.set_text("")
  19.         vertical_box.pack_start(self.username, True, True, 0)
  20.  
  21.         #Password input
  22.         self.password = Gtk.Entry()
  23.         self.password.set_text("aaaaaaaaaaa")
  24.         self.password.set_visibility(False)
  25.         vertical_box.pack_start(self.password, True, True, 0)
  26.  
  27.         #create login botton here
  28.         self.button = Gtk.Button(label="click me to login")
  29.         self.button.connect("clicked", self.function)
  30.         vertical_box.pack_start(self.button, True, True, 0)
  31.  
  32.         #create label
  33.         self.label= Gtk.Label()
  34.         vertical_box.pack_start(self.label, True, True, 0)
  35.  
  36.     #function of the button here bech ki tenzel 3al button y7ot lencode fel input 1
  37.     def function (self, widget):
  38.         self.label.set_text(base64.b64encode(b'data to be encoded'))
  39.  
  40. shinerghost = classInputs()
  41. shinerghost.connect("delete-event",Gtk.main_quit)
  42. shinerghost.show_all()
  43. Gtk.main()
  44.    
  45. def function (self, widget):
  46.     # Get the value from the input field
  47.     string = self.password.get_text()
  48.  
  49.     # Encode the string
  50.     encoded_string = base64.b64encode()
  51.  
  52.     # Set the label text
  53.     self.label.set_text(encoded_string)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top