#####
"""https://copyassignment.com/password-generator-in-python-gui-application/"""
#####
# importing the tkinter module
from tkinter import *
# importing the pyperclip module to use it to copy our generated
# password to clipboard
import pyperclip
# random module will be used in generating the random password
import random
# initializing the tkinter
root = Tk()
# setting the width and height of the gui
root.geometry("400x400") # x is small case here
# declaring a variable of string type and this variable will be
# used to store the password generated
passstr = StringVar()
# declaring a variable of integer type which will be used to
# store the length of the password entered by the user
passlen = IntVar()
# setting the length of the password to zero initially
passlen.set(0)
# function to generate the password
def generate():
# storing the keys in a list which will be used to generate
# the password
pass1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8',
'9', '0', ' ', '!', '@', '#', '$', '%', '^', '&',
'*', '(', ')']
# declaring the empty string
password = ""
# loop to generate the random password of the length entered
# by the user
for x in range(passlen.get()):
password = password + random.choice(pass1)
# setting the password to the entry widget
passstr.set(password)
# function to copy the password to the clipboard
def copytoclipboard():
random_password = passstr.get()
pyperclip.copy(random_password)
# Creating a text label widget
Label(root, text="Password Generator Application", font="calibri 20 bold").pack()
# Creating a text label widget
Label(root, text="Enter password length").pack(pady=3)
# Creating a entry widget to take password length entered by the
# user
Entry(root, textvariable=passlen).pack(pady=3)
# button to call the generate function
Button(root, text="Generate Password", command=generate).pack(pady=7)
# entry widget to show the generated password
Entry(root, textvariable=passstr).pack(pady=3)
# button to call the copytoclipboard function
Button(root, text="Copy to clipboard", command=copytoclipboard).pack()
# mainloop() is an infinite loop used to run the application when
# it's in ready state
root.mainloop()
Python의 tkinter 라이브러리를 사용하여 간단한 비밀번호 생성기 GUI 애플리케이션을 만든 것 같습니다. 이 애플리케이션을 사용하면 사용자는 비밀번호 길이를 지정한 다음 지정된 길이에 따라 무작위 비밀번호를 생성할 수 있습니다.
코드 분석은 다음과 같습니다.
필요한 모듈을 가져옵니다: GUI용 tkinter, 생성된 비밀번호를 클립보드에 복사하기 위한 pyperclip, 임의 문자 생성용 Random.
tkinter 인스턴스를 초기화하고 GUI 창의 형상을 설정합니다.
생성된 비밀번호와 사용자가 입력한 비밀번호 길이를 저장하기 위해 tkinter 변수( passstr및 )를 만듭니다.passlen
generate사용자가 지정한 길이에 따라 임의의 비밀번호를 생성하는 기능을 정의합니다 . 문자 목록( pass1)을 사용하여 무작위로 문자를 선택하여 암호를 만듭니다.
copytoclipboardpyperclip 모듈을 사용하여 생성된 비밀번호를 클립보드에 복사하는 함수를 정의합니다 .
라벨, 입력 필드, 버튼 등의 GUI 요소를 생성하고 이를 기능과 연결합니다.
를 사용하여 기본 GUI 이벤트 루프를 시작합니다 root.mainloop(). 이는 사용자가 창을 닫을 때까지 애플리케이션을 계속 실행합니다.
이 코드를 실행하면 원하는 비밀번호 길이를 입력할 수 있는 GUI가 생성됩니다. "비밀번호 생성" 버튼을 클릭하여 임의의 비밀번호를 생성한 다음 "클립보드에 복사" 버튼을 클릭하여 비밀번호를 클립보드에 복사합니다. .
귀하의 코드는 기본 비밀번호 생성기 애플리케이션에 맞게 구조화되어 있고 기능적으로 작동하는 것으로 보입니다. 필요한 경우 오류 처리를 추가하거나 사용자 인터페이스를 개선하여 이를 더욱 향상시킬 수 있습니다.
Google is cutting hundreds of jobs in its recruiting organization
Google workers walk outside of Google headquarters in Mountain View, Calif., Thursday, April 12, 2012. Google Inc. said Thursday that it earned $2.89 billion, or $8.75 per share, in the first quarter. That’s up from $1.8 billion, or $5.51 per share, a year earlier. (AP Photo/Paul Sakuma)
Paul Sakuma
Googleis cutting hundreds of jobs in its global recruiting organization as part of a broader pullback in hiring over the next several quarters, CNBC has confirmed.
“We unfortunately need to make a significant reduction to the size of the recruiting organization,” Brian Ong, Google’s recruiting vice president, told employees in a Wednesday video meeting, a recording of which was obtained by CNBC.
“It’s not something that was an easy decision to make, and it definitely isn’t a conversation any of us wanted to have again this year,” Ong said. “Given the base of hiring that we’ve received the next several quarters, it’s the right thing to do overall.”
Employees involved in the recruiting group reductions will receive emails starting Wednesday, Ong said.
In January,Alphabet-owned Googleannouncedit was cutting 12,000 jobs, affecting roughly 6% of the full-time workforce. The layoffs occurred across the company, including in Google’s recruiting organization. While Google has been in cost-cutting mode since last year, Alphabetreporteda 7% increase in second-quarter revenue, which was better than analysts expected.
Ong also said that employees hit in the latest layoffs will retain access to offices this week and online systems for longer. Employees had previouslycriticizedthe company for abruptly cutting off access to those who lost their jobs in January.
Courtenay Mencini,a Google spokesperson, confirmed the cuts in an email to CNBC.
“We continue to invest in top engineering and technical talent while also meaningfully slowing the pace of our overall hiring,” Mencini wrote. “In line with this, the volume of requests for our recruiters has gone down. In order to continue our important work to ensure we operate efficiently, we’ve made the hard decision to reduce the size of our recruiting team.”