Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
새 질병관리청 웹사이트 대응
Browse files Browse the repository at this point in the history
  • Loading branch information
jhk1090 committed Nov 2, 2021
1 parent eda85b1 commit fd86ebe
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions main.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,46 @@ def refresh():
soup = BeautifulSoup(target, "html.parser")
now = time.strftime("%Y. %m. %d")
result_.config(text="+ [옵션 선택]")
result.config(text="누적: ")
result1.config(text="전일대비: ")
result.config(text="일일: ")
result1.config(text="인구 10만명당: ")
refreshTime.config(text="기준: " + now)

def start(option: str):
stack = soup.find_all(class_="ca_value")
inner = soup.find_all(class_="inner_value")

if option == "확진환자":
result_.config(text="+ 확진환자")
result.config(text="누적: " + stack[0].text.strip())
result1.config(text="전일대비: " + inner[0].text.strip())
elif option == "격리해제":
result_.config(text="+ 격리해제")
result.config(text="누적: " + stack[2].text.strip())
result1.config(text="전일대비: " + stack[3].text.strip())
elif option == "격리중":
result_.config(text="+ 격리중")
result.config(text="누적: " + stack[4].text.strip())
result1.config(text="전일대비: " + stack[5].text.strip())
else:
for idx, i in enumerate(stack):
print(stack)
if option == "사망":
result_.config(text="+ 사망")
result.config(text="누적: " + stack[6].text.strip())
result1.config(text="전일대비: " + stack[7].text.strip())
result.config(text="일일: " + stack[0].text.strip())
result1.config(text="인구 10만명당: " + stack[1].text.strip())
elif option == "재원 위중증":
result_.config(text="+ 재원 위중증")
result.config(text="일일: " + stack[2].text.strip())
result1.config(text="인구 10만명당: " + stack[3].text.strip())
elif option == "신규입원":
result_.config(text="+ 신규입원")
result.config(text="일일: " + stack[4].text.strip())
result1.config(text="인구 10만명당: " + stack[5].text.strip())
else:
result_.config(text="+ 확진")
result.config(text="일일: " + stack[6].text.strip())
result1.config(text="인구 10만명당: " + stack[7].text.strip())

# 옵션 프레임
frame_option = LabelFrame(root, text="옵션")
frame_option.pack(padx=5, pady=5, ipady=5)

option = Button(frame_option, padx=5, pady=5, text="확진환자", command=lambda: start("확진환자"))
option = Button(frame_option, padx=5, pady=5, text="사망", command=lambda: start("사망"))
option.grid(row=0, column=0, padx=5, pady=5)

option1 = Button(frame_option, padx=5, pady=5, text="격리해제", command=lambda: start("격리해제"))
option1 = Button(frame_option, padx=5, pady=5, text="재원 위중증", command=lambda: start("재원 위중증"))
option1.grid(row=0, column=1, padx=5, pady=5)

option2 = Button(frame_option, padx=5, pady=5, text="격리중", command=lambda: start("격리중"))
option2 = Button(frame_option, padx=5, pady=5, text="신규입원", command=lambda: start("신규입원"))
option2.grid(row=0, column=2, padx=5, pady=5)

option3 = Button(frame_option, padx=5, pady=5, text="사망", command=lambda: start("사망"))
option3 = Button(frame_option, padx=5, pady=5, text="확진", command=lambda: start("확진"))
option3.grid(row=0, column=3, padx=5, pady=5)

# 결과 프레임
Expand All @@ -69,10 +70,10 @@ frame_result.pack(padx=5, pady=5, ipady=5)
result_ = Label(frame_result, text="+ [옵션 선택]", width=35, anchor=W)
result_.grid(row=0, column=0, sticky=W)

result = Label(frame_result, text="누적: -", width=35, anchor=W)
result = Label(frame_result, text="일일: -", width=35, anchor=W)
result.grid(row=1, column=0, sticky=W)

result1 = Label(frame_result, text="전일대비: -", width=35, anchor=W)
result1 = Label(frame_result, text="인구 10만명당: -", width=35, anchor=W)
result1.grid(row=2, column=0, sticky=W)

refreshTime = Label(frame_result, text="기준: " + now, width=35, anchor=E)
Expand Down

0 comments on commit fd86ebe

Please sign in to comment.