I have this code :
def on_btn_login_clicked(self, widget):
email = self.log_email.get_text()
passw = self.log_pass.get_text()
self.lbl_status.set_text("Connecting ...")
params = urllib.urlencode({'@log_email': email, '@log_pass': passw, '@action': 'login', '@module': 'user'})
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
conn = httplib.HTTPConnection("website.com")
self.lbl_status.set_text("Logging in ...")
conn.request("POST", "/ajax.php", params, headers)
response = conn.getresponse()
print response.status
self.lbl_status.set_text("")
data = response.read()
print data
conn.close()
The self.lbl_status
doesn't change till the request is finished, so it displays nothing due to the last set_text
function.
Why is this happening, and how to avoid/fix that?