ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pythoncard
pythoncard
[Pythoncard-users] Re: Pythoncard mental block
by Gregory Piņero other posts by this author
Oct 7 2005 9:49PM messages near this date
[Pythoncard-users] [ANN] Dabo 0.4.2 released! | Re: [Pythoncard-users] Re: Pythoncard mental block
The Python-Card guys are really helpful, <
pythoncard-users@[...].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@[...].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> )
Attachments:
unknown1
unknown2
unknown3
unknown4
unknown1
unknown2

Thread:
Gregory Piņero
Alex Tweedly

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved