[PyKDE] KPasswordDialog and KWallet

Hans van Leeuwen hanz at hanz.nl
Fri Nov 24 16:43:38 GMT 2006

Hi all,

Let me start by saying I just started using PyKDE and it's been a lot of fun. 
I have never used Python, nor done any GUI-progamming until last week, and 
I've already managed to create a few useable programs.

The question I have is regarding KPasswordDialog and KWallet. I'm writing a 
program which asks the user for a password, and passes it on to an external 
application, which returns an error if the password is incorrect.

I would really like to be able to store the password using KWallet, but I 
can't figure out how to do that.

I use the following function:

def getPass():
	password = QCString();
        prompt = "Enter your password"
        KPasswordDialog.getPassword(password, prompt)
	return password

It asks for the password and returns the entered value, but there is no "Keep 
password" checkbox.

If I use "password = 'foobar'", the checkbox appears, but this is not what I 
want, because I don't know the correct password beforehand.

In the KpasswordDialog API-docs I see an option "enableKeep", but I have no 
idea how to use it.

Can somebody tell me how I can save my password using Kwallet?



More information about the PyQt mailing list