Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 29th, 2012, 02:49 PM
noskiw noskiw is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 18 noskiw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 30 m 46 sec
Reputation Power: 0
Password Input

I'm currently doing my coursework for computing, and currently I'm making a registration section.

What I'm struggling with is getting the input entry to show Astrix's or circles.

I'm using the module graphics.

Code:
from graphics import *
import urllib.request, re

def Login():
    LoginScreen = GraphWin("Login",300,100)
    file = open("users.csv","r")
    readfile = file.read()
    UsernameLabel = Text(Point(45,25),"Username: ")
    UsernameLabel.draw(LoginScreen)
    UsernameText = Entry(Point(158,25),16)
    UsernameText.draw(LoginScreen)
    username = ''
    LoginScreen.getMouse()
    LoginScreen.close()

def Register():
    RegisterScreen = GraphWin("Register",300,150)
    UsernameRegLabel = Text(Point(45,25),"Username: ")
    UsernameRegLabel.draw(RegisterScreen)
    UsernameRegText = Entry(Point(158,25),16)
    UsernameRegText.draw(RegisterScreen)
    PasswordRegLabel = Text(Point(45,50),"Password: ")
    PasswordRegLabel.draw(RegisterScreen)
    PasswordRegText = Entry(Point(158,50),16)
    PasswordRegText.draw(RegisterScreen)
    RegisterScreen.getMouse()
    RegisterScreen.close()

def GetMouse():
    p = MainWin.getMouse()
    x = p.getX()
    y = p.getY()
    print(x)
    print(y)
    if x>=197 and x<=260:
        if y>=230 and y<=250:
            Login()
    if x>=197 and x<=297:
        if y>=260 and y<=285:
            Register()
    
def DrawBackground():
    return
    
def DrawMenuItems():
    Main = Text(Point(300,200),"Main Menu")
    Main.setSize(32)
    Main.draw(MainWin)
    Login = Text(Point(228,240),"Login")
    Login.setSize(20)
    Login.draw(MainWin)
    Register = Text(Point(245,270),"Register")
    Register.setSize(20)
    Register.draw(MainWin)

MainWin = GraphWin("Fantasy Football",600,600)

DrawBackground()
DrawMenuItems()
while True:
    GetMouse()


The bit I'm struggling with is
Code:
PasswordRegText = Entry(Point(158,50),16)
PasswordRegText.draw(RegisterScreen)


How do I get it to show circles or Asterixs?

Reply With Quote
  #2  
Old November 29th, 2012, 04:20 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,383 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 13 h 44 m 29 sec
Reputation Power: 383
asterisk.

Use this symbol:

In base 10 the unicode number is 9055.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
  #3  
Old November 29th, 2012, 07:38 PM
dwblas dwblas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 294 dwblas User rank is Corporal (100 - 500 Reputation Level)dwblas User rank is Corporal (100 - 500 Reputation Level)dwblas User rank is Corporal (100 - 500 Reputation Level)dwblas User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 18 h 55 m 26 sec
Reputation Power: 7
If you want * in the box you can use setText. If you want each character entered to show as an asterisk, I don't think the graphics module can do that. Look at the "show=" option in Tkinter's entry box.
Code:
from Tkinter import *

class PasswordGetter:
    def __init__(self):
        self.root = Tk()
        frame = Frame(self.root)

        lbl = Label(frame, text="Username ")
        lbl.grid(row=0, column=0, stick=N+E+S+W)

        self.user_name = StringVar()
        self.username_entry = Entry(frame, width=20, \
                              textvariable=self.user_name)
        self.username_entry.grid(row=0, column=1, stick=N+E+S+W)

        lbl = Label(frame, text="Password ")
        lbl.grid(row=1, column=0, stick=N+E+S+W)

        self.passw = StringVar()
        self.password_entry = Entry(frame, show="*", width=20, textvariable=self.passw
        self.password_entry.grid(row=1, column=1, stick=N+E+S+W)

        login_button = Button(text="Login",
                               command=self.buttonCallback)
 
        login_button = Button(text="Login",
                               command=self.buttonCallback)
        login_button.grid(row=2, columnspan=2, stick=N+E+S+W)

        frame.grid(row=0, padx=2, pady=2, stick=N+E+S+W)
        self.root.mainloop()


    def buttonCallback(self):
            print self.user_name.get(), self.passw.get()
            self.root.destroy()

if __name__ == "__main__":
    pg = PasswordGetter() 

Reply With Quote
  #4  
Old November 29th, 2012, 07:41 PM
dwblas dwblas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 294 dwblas User rank is Corporal (100 - 500 Reputation Level)dwblas User rank is Corporal (100 - 500 Reputation Level)dwblas User rank is Corporal (100 - 500 Reputation Level)dwblas User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 18 h 55 m 26 sec
Reputation Power: 7
You can use setText to set the text shown in an Entry box. If you want each character entered to display as an * I don't think the Graphics module can do that. Look at the "show=" option in the Tkinter entry box.
Code:
class PasswordGetter:
    def __init__(self):
        self.root = Tk()
        frame = Frame(self.root)

        lbl = Label(frame, text="Username ")
        lbl.grid(row=0, column=0, stick=N+E+S+W)

        self.user_name = StringVar()
        self.username_entry = Entry(frame, width=20, \
                              textvariable=self.user_name)
        self.username_entry.grid(row=0, column=1, stick=N+E+S+W)

        lbl = Label(frame, text="Password ")
        lbl.grid(row=1, column=0, stick=N+E+S+W)

        self.passw = StringVar()
        self.password_entry = Entry(frame, show="*", width=20, textvariable=self.passw)
        self.password_entry.grid(row=1, column=1, stick=N+E+S+W)

        login_button = Button(text="Login",
                               command=self.buttonCallback)
        login_button.grid(row=2, columnspan=2, stick=N+E+S+W)

        frame.grid(row=0, padx=2, pady=2, stick=N+E+S+W)
        self.root.mainloop()


    def buttonCallback(self):
            print self.user_name.get(), self.passw.get()
            self.root.destroy()

if __name__ == "__main__":
    pg = PasswordGetter() 

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Password Input

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap