from tkinter import *
from datetime import datetime
import requests
from bs4 import BeautifulSoup
win = Tk() #창 생성
def lotto_print():
n=ent.get()
req=requests.get(url)
soup=BeautifulSoup(req.text,"html.parser")
txt=soup.find("div",attrs={"class","win_result"}).get_text().split("\n")
num_list = txt[7:13]
bonus=txt[-4]
print(num_list, bonus)
win.geometry("1300x600")
win.title("일용작업증")
win.option_add("*Font","궁서 20")
def what_time():
dnow=datetime.now().strftime("%Y-%m-%d %H:%M:%S")
btn.config(text=dnow)
ent = Entry(win)
def lotto_p():
n=ent.get()
req=requests.get(url)
soup=BeautifulSoup(req.text,"html.parser")
txt=soup.find("div",attrs={"class","win_result"}).get_text().split("\n")
num_list = txt[7:13]
bonus=txt[-4]
# .config(text=num_list)
lbl.config(text=f'{n}차 번호:{num_list} 보너스:{bonus}')
print(num_list, bonus)
btn_2 = Button(win)
btn_2.config(text="로또 당첨 번호 확인")
btn_2.config(command=lotto_p)
btn_2.pack()
ent.pack()
lbl = Label(win)
lbl.config(width=50,height=5)
lbl.config(text="로또번호")
lbl.config(bg="yellow")
lbl.pack()
btn = Button(win)
btn.config(text="현재시각")
btn.config(width=30, height=3)
btn.config(command=what_time)
btn.pack()
win.mainloop() # 창 실행