我现在才刚刚开始学习python,我想我可以尝试构建一个基本的计算器,这样我可以学习一些GUI概念,也可以学习后端概念。以下是我目前掌握的代码:
import tkinter
from tkinter import *
from tkinter import Button
import sys
import math
mainBox = Tk()
ment = StringVar()
mainBox.geometry("400x200")
mainBox.title("HandyCalc")
#Welcome screen buttons
welcomeLabel = Label(mainBox, text="Welcome to HandyCalc! Input your first
number here: ")
welcomeEntry = Entry()
welcomeContinue = Button(mainBox, text = "Continue", command = continueFunc)
def continueFunc():
if welcomeEntry != int:
intErr = Tk()
def welcome ():
print(welcomeLabel.pack())
print(welcomeEntry.pack())
print(welcomeContinue.pack())
def main():
welcome()
main()
当我运行这个程序时,窗口弹出,但是控制台返回一个错误“contineFunc is not defined”。我已经研究了很多类似问题的文章,但到目前为止还没有这样的运气。谢谢你的帮助。在
下面的代码将
button
绑定到function
(这print
是演示的字符串),而且它的只是:相关问题 更多 >
编程相关推荐