I want to use base 64
and print the encode result into Gtk.Label
, this is my code so far:
from gi.repository import Gtk
import base64
class classInputs(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Inputs try window")
self.set_border_width(10)
self.set_size_request(200,100)
# Layout
vertical_box = Gtk.Box(orientation = Gtk.Orientation.VERTICAL, spacing = 8)
self.add(vertical_box)
#userName input
self.username = Gtk.Entry()
self.username.set_text("")
vertical_box.pack_start(self.username, True, True, 0)
#Password input
self.password = Gtk.Entry()
self.password.set_text("aaaaaaaaaaa")
self.password.set_visibility(False)
vertical_box.pack_start(self.password, True, True, 0)
#create login botton here
self.button = Gtk.Button(label="click me to login")
self.button.connect("clicked", self.function)
vertical_box.pack_start(self.button, True, True, 0)
#create label
self.label= Gtk.Label()
vertical_box.pack_start(self.label, True, True, 0)
#function of the button here bech ki tenzel 3al button y7ot lencode fel input 1
def function (self, widget):
self.label.set_text(base64.b64encode(b'data to be encoded'))
shinerghost = classInputs()
shinerghost.connect("delete-event",Gtk.main_quit)
shinerghost.show_all()
Gtk.main()
Any ideas on how I can achieve that?