首先我有一个工作正常的 sqrt 按钮,然后我添加了 pi 按钮,但没有任何效果,我尝试更改所有内容,但我仍然不知道出了什么问题!请有人帮忙。
import sys
from tkinter import *
from math import *
def sqrt_():
text = ment.get()
a = sqrt(text)
label['text'] = a
def pi_():
text = ment.get()
a = pi(text)
label_1['text'] = a
root = Tk()
root.title('Conversions')
root.geometry('400x400')
#Get square root
sqrt_button = Button(root, text='Get Square root',command= sqrt_).place(x='160', y='5')
label = Label(root, text='')
label.place(x=5, y=30)
ment = IntVar()
entry = Entry(textvariable=ment).place(x='5', y= '10 ')
#Get Pi
pi_button = Button(root, text='Get Pi',command= pi_).place(x='160', y='50')
label_1 = Label(root, text='')
label_1.place(x=55, y=200)
ment = IntVar()
entry_1 = Entry(textvariable=ment).place(x='5', y= '55 ')
root.mainloop()