# sg.计算器

# sg.计算器

# sg.计算器

import PySimpleGUI as sg
progress = sg.ProgressBar(100)
num1_inp = sg.Input(size=5)
num2_inp = sg.Input(size=5)
result_txt = sg.Text()
add_btn = sg.Button('add')

layout=[
    [num1_inp,num2_inp,
    result_txt],
    [progress],
    [add_btn]
]

window = sg.Window('slow calculator',layout)

while True:
    event, value = window.read()
    if event == sg.WINDOW_CLOSED:break
    if event == 'add':
        num1 = int(num1_inp.get())
        num2 = int(num2_inp.get())
        result_txt.update(str(num1 + num2))
posted @ 2025-12-10 00:10  nxhujiee  阅读(4)  评论(0)    收藏  举报