示例#1
0
    def initUI(self):
        # Create identifier drop down menu
        self.identifierSelector = AutocompleteBox(
            self.parent,
            label="Select a drop-down menu to edit",
            toolTip="placeholder")
        self.identifierSelector.initDropDown(
            self.app.listDropDownIdentifiers())
        self.identifierSelector.comboBox.bind('<<ComboboxSelected>>',
                                              self.handleIdentifierSelect)
        self.identifierSelector.pack()

        Label(self.parent).pack()

        # Create listbox widget
        listFrame = Frame(self.parent)
        scrollBar = Scrollbar(listFrame, orient=VERTICAL)
        self.optionsListBox = Listbox(listFrame,
                                      selectmode=SINGLE,
                                      yscrollcommand=scrollBar.set)
        scrollBar.config(command=self.optionsListBox.yview)
        scrollBar.pack(side=RIGHT, fill=Y)
        self.optionsListBox.pack(side=LEFT, fill=BOTH, expand=1)
        listFrame.pack(fill=BOTH, expand=1)

        deleteButton = Button(self.parent,
                              text="Delete selection entry",
                              command=self.handleDeleteButton)
        deleteButton.pack()

        Label(self.parent, text="OR").pack()

        Label(self.parent, text="Add a new entry").pack()
        self.newOptionEntry = Entry(self.parent)
        self.newOptionEntry.pack()
        addButton = Button(self.parent,
                           text="Add entry",
                           command=self.handleAddButton)
        addButton.pack()
示例#2
0
文件: login.py 项目: GorioB/uftrs-app
	def initUI(self):
		self.parent.geometry("570x570")

		# Notebook
		self.notebook = Notebook(self.parent)
		self.notes={}
		for i in ["Log In", "Create Account", "Change Password", "Reset Forgotten Password"]:
			self.notes[i]=Frame(self.notebook)
			self.notebook.add(self.notes[i],text=i)
		self.notebook.pack(fill=BOTH,expand=1)
		self.notebook.pack_propagate(0)

		# Log in widgets
		logInFrame = self.notes["Log In"]
		Label(logInFrame, text="Enter username").pack()
		self.logIn_username = Entry(logInFrame)
		self.logIn_username.pack()
		Label(logInFrame, text="Enter password").pack()
		self.logIn_password = Entry(logInFrame,show="*")
		self.logIn_password.pack()
		## Submit button and text notifier
		Label(logInFrame, text="").pack()
		self.logIn_submit = Button(logInFrame, text="Submit", command=self.submitLogIn)
		self.logIn_submit.pack()
		self.logIn_notifier = Label(logInFrame)
		self.logIn_notifier.pack()

		self.logInEntries.append(self.logIn_username)
		self.logInEntries.append(self.logIn_password)

		#press enter to submit
		self.logIn_username.focus()
		self.logIn_password.bind("<Return>",self.submitLogIn)

		# Create account widgets
		## Admin account widgets
		createFrame = self.notes["Create Account"]
		Label(createFrame, text="Enter administrator username").pack()
		self.create_adminUser = Entry(createFrame)
		self.create_adminUser.pack()
		Label(createFrame, text="Enter administrator password").pack()
		self.create_adminPass = Entry(createFrame, show="*")
		self.create_adminPass.pack()
		## New user account widgets
		self.create_isAdmin = IntVar()
		self.create_adminCheckBox = Checkbutton(createFrame, text="Create the new account as an administrator", variable=self.create_isAdmin)
		self.create_adminCheckBox.pack()
		Label(createFrame, text="").pack()
		Label(createFrame, text="Enter new account's username").pack()
		self.create_newUser = Entry(createFrame)
		self.create_newUser.pack()
		Label(createFrame, text="Enter new account's password").pack()
		self.create_newPass = Entry(createFrame, show="*")
		self.create_newPass.pack()
		Label(createFrame, text="Re-enter new account's password").pack()
		self.create_newPass2 = Entry(createFrame, show="*")
		self.create_newPass2.pack()

		Label(createFrame, text="""\nEnter a secret question for your new account (e.g. "What is your first pet's name?") and the answer to it. This secret question will be used for resetting your password in case you forget it.\n"""
			, wraplength=350, justify=CENTER).pack()

		Label(createFrame, text="Enter new account's secret question").pack()
		self.create_secretQ = Entry(createFrame)
		self.create_secretQ.pack()
		Label(createFrame, text="Enter new account's secret answer").pack()
		self.create_secretA = Entry(createFrame)
		self.create_secretA.pack()

		self.createEntries.append(self.create_adminUser)
		self.createEntries.append(self.create_adminPass)
		self.createEntries.append(self.create_newUser)
		self.createEntries.append(self.create_newPass)
		self.createEntries.append(self.create_newPass2)
		self.createEntries.append(self.create_secretQ)
		self.createEntries.append(self.create_secretA)

		## Submit button and text notifier
		self.create_submit = Button(createFrame, text="Register New User", command=self.submitCreateUser)
		self.create_submit.pack()
		self.create_notifier = Label(createFrame)
		self.create_notifier.pack()

		## bind submitCreateUser to return event on last entry
		self.create_secretA.bind("<Return>",self.submitCreateUser)

		# Change password widgets
		changeFrame = self.notes["Change Password"]
		Label(changeFrame, text="Enter username").pack()
		self.change_user = Entry(changeFrame)
		self.change_user.pack()
		Label(changeFrame, text="Enter password").pack()
		self.change_oldPass = Entry(changeFrame, show="*")
		self.change_oldPass.pack()
		Label(changeFrame, text="").pack()
		Label(changeFrame, text="Enter new password").pack()
		self.change_newPass = Entry(changeFrame, show="*")
		self.change_newPass.pack()
		Label(changeFrame, text="Re-enter new password").pack()
		self.change_newPass2 = Entry(changeFrame, show="*")
		self.change_newPass2.pack()
		## Submit button and text notifier
		Label(changeFrame, text="").pack()
		self.change_submit = Button(changeFrame, text="Change Password", command=self.submitChangePass)
		self.change_submit.pack()
		self.change_notifier = Label(changeFrame)
		self.change_notifier.pack()
		## bind submitChangePass to last entry
		self.change_newPass2.bind("<Return>",self.submitChangePass)

		self.changePasswordEntries.append(self.change_user)
		self.changePasswordEntries.append(self.change_oldPass)
		self.changePasswordEntries.append(self.change_newPass)
		self.changePasswordEntries.append(self.change_newPass2)


		# Reset password widgets
		resetFrame = self.notes["Reset Forgotten Password"]
		Label(resetFrame, text="\nThis page lets you reset your account's password if you've forgotten it.\n").pack()
		## Username selector
		newFrame = Frame(resetFrame)
		newFrame.pack()
		self.reset_userSelector = AutocompleteBox(newFrame, label="Select your username")
		self.reset_userSelector.initDropDown(User.listUsernames())
		self.reset_userSelector.comboBox.bind('<<ComboboxSelected>>', self.handleResetUserSelect)
		self.reset_userSelector.pack()

		Label(resetFrame, text="\n").pack()
		self.reset_secretQ = Label(resetFrame, wraplength=350, justify=CENTER)
		self.reset_secretQ.pack()


		Label(resetFrame, text="\nEnter answer").pack()
		self.reset_answer = Entry(resetFrame)
		self.reset_answer.pack()

		Label(resetFrame, text="Enter new password").pack()
		self.reset_newPass = Entry(resetFrame, show="*")
		self.reset_newPass.pack()
		Label(resetFrame, text="Re-enter new password").pack()
		self.reset_newPass2 = Entry(resetFrame, show="*")
		self.reset_newPass2.pack()

		self.reset_submit = Button(resetFrame, text="Change password", command=self.submitResetPass)
		self.reset_submit.pack()

		self.reset_notifier = Label(resetFrame)
		self.reset_notifier.pack()

		self.resetPasswordEntries.append(self.reset_answer)
		self.resetPasswordEntries.append(self.reset_newPass)
		self.resetPasswordEntries.append(self.reset_newPass2)