Hello.

As a new python student we all tried the password program

Mine looked like this :)

def Password():
    password = ent.get()
    if password == '12345':
        ent.delete(0,END)
        ent.insert(0,'Welcome Back Aiban')
    else:
        ent.delete(0,END)
        ent.insert(0,'Incorrect')

ok ... it does it's job and shows me when i get it right or when i get it wrong.
But how can i turn this into something more useful. In terms of ... well i have a window full of buttons including the password code right at the top.... thing is right now ... you can ignore it .. and move on and click all the other functions of the buttons without even using the password as the password isn't exactly linked to the rest of the program.

Ideally i would love to see the whole interface hidden UNTIL the correct password is typed .. then reveal the rest .... or the password dialogue to appear in a windows on top of the main menu (and the main menu cannot be touched until password is typed) .
Thinking outside the box a bit .... how about a blank canvas that COVERS all the program buttons except password and is removed ONCE the correct password is typed.

Looking for ideas on how to implement, code snippets and if it is time to shutup :) yeha yeah .. i type alot :)

Recommended Answers

All 5 Replies

If you were using an older version of python and working in the wx GUI toolkit I would suggest using a simple dialog box and giving it the directive ShowModal() , which makes it the only window with focus. No other parent window can be accessed until the dialog box has been taken care of. Then you could simply write in code to close the entire program if the dialog box is "cancelled" or closed.

Unfortunately I'm not that versed in tkinter, so I'm not sure if similar functionality exists or not.

I tried it anyways :) but it didn't work ... although i also did not get any error ... L( but if anyone knows a tkinter solution, would love to hear, intersly your suggestion is part of another problem i am trying to solve as i type .. how to lock focus on a window so the other windows canot be touched. Finding that solution might help me solve this one as well.

I tried it anyways :) but it didn't work ... although i also did not get any error ... L( but if anyone knows a tkinter solution, would love to hear, intersly your suggestion is part of another problem i am trying to solve as i type .. how to lock focus on a window so the other windows canot be touched. Finding that solution might help me solve this one as well.

Perhaps then your solution is to switch GUI toolkits!

I've always preferred wx over tk and anxiously await a 3.0 compliant version of wx

Yeah, i know it can be done .. i'm sure ... and it seems like a use a hammer to kill the fly answer since that would mean also downgrading the python version just to use a different toolkit, only to be regraded later when wx works with v3 and then i reupgrade.

Messy hey .... if i'd been doing this a year ago, i would certainly have held off my upgrade, i'll hang around for awhile longer and see if any other solutions come up, i also read a fairly lengthy thing on tkinter and focus of windows but that was from 1999 :)

mean also downgrading the python version just to use a different toolkit, only to be regraded later when wx works with v3 and then i reupgrade.

There is now upp and downgrade in python.
Most off us you 2.x,that dosent mean that we dont test python 3.x out.
Have off course both 2.x and 3.x installed.

There are to much info and 3 part modules one need to only use 3.x
And most books are for 2.x

When learing 2.x you do off couse learn 3.x,they changes arent that big.

You can use 2to3 module for covert code from 2.x to 3.x
That`s work fine,but not needed more for test to see the difference.

One day all will use 3.x,but why hurry?

If one only use 3.x will this not give any advances in the future?
No not at all,because all info about learing this great language is in 2.x
This is info man for sure need.
They changes are way to small to trow that info away.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.