파이썬 질문!

파이썬 질문!

QA

신고된 글파이썬 질문!

본문

신고가 접수되어 자동으로 블라인드 된 글입니다.
원글을 보시려면 를 클릭하세요.

from tkinter import *
window = Tk()
window.title("My Calculator")
display = Entry(window,bg="yellow", font='30')
display.grid(row=0,column=0, columnspan='5')


button_list =  [
'7', '8', '9', '/', 'C',
'4', '5', '6', '*', '웹사이트',
'1', '2', '3', '-', '도형',
'0', '.', '=', '+', '연락처' ]


def click(key):
    if key == "=":
        result = eval(display.get())
        s = str(round(result,2))
        display.insert(END, "=" + s)
    elif key == "C":
        display.delete(0,END)
    elif key == "연락처":
        infile=open("phones.txt","r")
        lines=infile.read()
        print(lines)
        infile.close()
    elif key == "웹사이트":
        from tkinter import *

        root=Tk()
        root.title("My calculator")
        def process1():
            child=Toplevel(root)
            child.title("웹사이트")
            button=Button(child,text="닫기",command=child.destroy)
            button.pack(padx=100,pady=50)
        button=Button(root.text="웹사이트",command=process1)
        button.pack(padx=100,pady=50)
        window.mainloop()
    else:
        display.insert(END, key)
   


r=1 #grid의 행위치 변수  1,2,3,4
c=0 #grid의 열위치 변수  0,1,2,3,4
  
for button_text in button_list:
    def process(t=button_text):
        click(t)
    Button(window,text=button_text,font='50',command=process).grid(row=r,column=c,sticky='ew')
    c+=1
    if c>4:
        c=0
        r+=1

 

실행하면 expression cannot contain assignment,perhaps you meant "==" ? 라고 나오는데 어디가 문제일까요?  오류는 elif 웹사이트 부분에서 나와요

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
전체 123,532 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT