Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [........
- user = input('Enter Your UserName:')
- pass = input('Enter Your Password:')
- ........]
- Warning (from warnings module):
- return fallback_getpass(prompt, stream)
- GetPassWarning: Can not control echo on the terminal.
- Warning: Password input may be echoed.
- import sys
- shell = sys.stdout.shell
- shell.show input as '0';
- ....
- import sys
- import os
- import getpass
- sys.stdout = os.devnull
- getpass.getpass()
- == RESTART: Shell ==
- # import tkinter (a crossplatform GUI)
- import tkinter
- # import a simple dialog form with a label and a button
- # so you don't have to build one yourself
- import tkinter.simpledialog
- # create an empty main window for GUI,
- # without it you will get an error:
- # AttributeError: 'NoneType' object has no attribute 'winfo_viewable'
- tk_root = tkinter.Tk()
- # you don't really need to show it, so hide it immediately
- tk_root.withdraw()
- # create a dialog window with title 'Password'
- # and a text label 'Enter Your Password:'
- # also hide typed password with *
- passwd = tkinter.simpledialog.askstring('Password','Enter Your Password:', show='*')
- def get_pass():
- import tkinter
- import tkinter.simpledialog
- tk_root = tkinter.Tk()
- tk_root.withdraw()
- return tkinter.simpledialog.askstring('Password','Enter Your Password:', show='*')
- from tkinter import * #(tkinter (A cross-platform GUI)
- top = Tk()
- def callback(): #what to do after button(Submit) pressed
- print(E2.get()) #printing first input
- print(E1.get()) #printing second input
- top.destroy() #exiting tkinter
- top.title('Login')
- L1 = Label(top, text="User Name")
- L1.grid(row=0, column=0) #setting up position for user name field
- E2 = Entry(top, bd = 5)
- E2.grid(row=0, column=1)
- L1 = Label(top, text="Password") # text for second name,currently Password
- L1.grid(row=1, column=0) #setting up position for password field
- E1 = Entry(top, bd = 5,show='*') #hidding the text with *
- E1.grid(row=1, column=1)
- MyButton1 = Button(top, text="Submit", width=10, command=callback) # button named submit
- # 'command=callback ' the command you want to do|we have created a function callback
- MyButton1.grid(row=3, column=1) # position for button
- top.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement