ziheng - Calculator

import tkinter as tk
window = tk.Tk()
window.geometry("280x500")
window.title("计算器")

# 显示结果
la1 = tk.Label(
    window,
    font=(None,30),
    bg="#0000CD",
    fg="white",
    bd=1,
    anchor="se",# 锚  north北  east 东   west西  south 南
    text="显示结果"
)
la1.place(x=0, y=0, width=280,height=170)
# 显示公式
la2 = tk.Label(
    window,
    font = (None,30),
    bg = "#0000FF",
    fg = "#7B68EE",
    bd = 1,
    anchor = "se",
    text = "显示公式"
)
la2.place(x = 0,y = 170,width = 280,height = 60)
# 写一个按钮
btnAC = tk.Button(
    window,
    text="AC",
    font=(None,20),
    fg="#00BFFF",
)
btnAC.place(x=0, y=230,width=70,height=55)

bthx = tk.Button(
    window,
    text = "*",
    font = (None,20),
    fg = "#87CEFA",
)
bthx.place(x = 210,y = 230,width = 70,height = 55)
bth7 = tk.Button(
    window,
    text="7",
    font=(None, 20),
    fg="#87CEFA",
)
bth7.place(x=0, y=285, width=70, height=55)

bthc = tk.Button(
    window,
    text="/",
    font=(None, 20),
    fg="#87CEFA",
)
bthc.place(x = 140, y = 230, width=70, height=55)


window.mainloop()
Published 530 original articles · won praise 21 · views 20000 +

Guess you like

Origin blog.csdn.net/houlaos/article/details/105215613