【发布时间】:2020-10-18 15:46:56
【问题描述】:
下面的代码是我的python代码。我正在尝试用 GUI Tkinder 制作一个简单的计算器,但是这里的网格系统对我来说不能正常工作,请大家说是什么问题。
from Tkinter import *
from tkinter import font
window = Tk()
Screen = Label(window,
text="Calculator",
bg="#2ecc71",
width=26,
height=2,
font=("Verdana", 22))
myFont = font.Font(size=12)
num7 = Button(window,
text=7,
height=5,
width=10)
num7['font'] = myFont
num8 = Button(window,
text=8,
height=5,
width=10)
num8['font'] = myFont
num9 = Button(window,
text=9,
height=5,
width=10)
num9['font'] = myFont
window.geometry("500x500+420+120")
#window.resizable(False, False) #commented for seeing the button that comes out of the boundary
window.title("Calculator -by Jobin")
Screen.grid(row=0, column=0, padx=10, pady=10)
num7.grid(row=1, column=0)
num8.grid(row=1, column=1)
num9.grid(row=1, column=2)
window.mainloop()
【问题讨论】:
标签: python user-interface tkinter