편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.07.21

    증가 버튼을 누르면 엔트리 값이 1씩 증가하도록 하고 싶은데 어떻게 해야 할까요


    from tkinter import *
    
    from tkinter import messagebox
    
    window=Tk()
    
    
    global total
    total=0
    #버튼 명령
    
    def click(key):
    
        global total
        if key=='증가':
            total+=1
        else:
            total=0
        num_var.set(total)
    #라벨생성
    
    
    sum=Entry(window)
    
    sum.grid(row=0,column=1)
    
    l1=Label(window, text="계수기")
    
    l1.grid(row=0,column=0)
    
    
    b1=Button(window,text="증가", command=update_add)
    
    b1.grid(row=1, column=2)
    
    
    
    operator_list=['증가']
    
    
    r=1
    
    for x in operator_list:
    
        def process():
            click(x)
        b1=Button(window, text="증가",command=process)
        b1.grid(row=1, column=2)
    
    window.mainloop()
    
  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.07.20

    증가 버튼을 누르면 엔트리 값이 1씩 증가하도록 하고 싶은데 어떻게 해야 할까요


    from tkinter import *

    from tkinter import messagebox

    window=Tk()

    global total total=0

    버튼 명령

    def click(key):

    global total
    if key=='증가':
        total+=1
    else:
        total=0
    num_var.set(total)
    

    라벨생성

    sum=Entry(window)

    sum.grid(row=0,column=1)

    l1=Label(window, text="계수기")

    l1.grid(row=0,column=0)

    b1=Button(window,text="증가", command=update_add)

    b1.grid(row=1, column=2)

    operator_list=['증가']

    r=1

    for x in operator_list:

    def process():
        click(x)
    b1=Button(window, text="증가",command=process)
    b1.grid(row=1, column=2)
    

    window.mainloop()