Pythoncard mental block

Gregory Piñero gregpinero at gmail.com
Sat Oct 8 00:48:37 EDT 2005


The Python-Card guys are really helpful, <
pythoncard-users at lists.sourceforge.net>, you may have to register on
sourceforge to get on their list.

In the meantime I went ahead and cc'd them on this. Python-Card guys, make
sure to cc Steven as he may not be on the list.

-Greg


On 10/7/05, Steven D'Aprano <steve at removethiscyber.com.au> wrote:
>
> On Fri, 07 Oct 2005 10:25:24 -0700, jlocc wrote:
>
> > Hi!!
> >
> > I am working on a school project and I decided to use PythonCard and
> > wxPython for my GUI development. I need a password window that will
> > block unwanted users from the system. I got the pop-up password
> > question to work...
>
> I haven't seen any replies to this, so even though I don't actually
> use Pythoncard I'll take a wild shot in the dark.
>
>
> > def on_openBackground(self, event):
> >
> > result = dialog.textEntryDialog(self,
> > 'System',
> > 'Please enter your password: ',
> > '')
> >
> > .....but I don't exactly remember how to check if the entered password
> > is correct. Say I hard code the password to be 'hello', then how would I
> > check if this was the input or if it wasn't???
>
> Start with looking at result and seeing what is in it. If it is the input
> string, then just say
>
> if result == 'hello':
> # do whatever you need to
> else:
> # put up a dialog saying 'Password does not match!'
>
> But I'm guessing from the syntax that the dialog instance itself is stored
> in result, so perhaps you need to look at some attribute of result:
>
> if result.userInput == "hello": # or something like that?
>
> Lastly, I might not have used Pythoncard, but years ago I used to use
> Hypercard rather a lot. In Hypercard, the password dialog would use a
> one-way hash function to encrypt the typed response into a large integer
> value. I assume Pythoncard is designed to do the same thing as Hypercard.
>
> So, in rusty Hypercard syntax with Python-style comments:
>
> # retrieve the numeric value of the password
> put field "hidden password" into userpassword
> # put up a dialog asking the user to enter a password
> ask password "Please enter your password:"
> if the result is "" then:
> # the user clicked Cancel, so just abort or go away or something
> go home
> else if the result is userpassword:
> # we have a match!
> go to card "Secret card"
> else:
> # password doesn't match
> go to card "Password failure"
>
>
> Hope this is of some help to you, and I haven't led you too far astray.
>
>
> --
> Steven.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com <http://www.blendedtechnologies.com>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051008/23f1ea89/attachment.html>


More information about the Python-list mailing list