今天,小蔡想做一个可以答题的小工具

于是小蔡试用python tkinter 做了一个数学小练习

import tkinter.messagebox


def num(n):
    if n == "3":
        tkinter.messagebox.showinfo("答对了", "答对了")
    else:
        tkinter.messagebox.showerror("答错了", "答错了")


win = tkinter.Tk()
win.title('数学小练习')
win.geometry('300x200+600+250')
lab = tkinter.Label(win, text="1+2=", font=("Arial", 36))
lab.place(x=50, y=30)
ent = tkinter.Entry(win, font=("Arial", 36))
ent.place(x=170, y=35, width=80)
btn = tkinter.Button(win, text='hello', font=("Arial", 24), command=lambda: num(ent.get()))
btn.place(x=100, y=105)
win.mainloop()

 【python综合运用】制作数学小练习(一)

 

 【python综合运用】制作数学小练习(一)

做好程序之后,小蔡想把自己做的小练习给楚煌看看

但是楚煌没有安装python

所以小蔡用pyinstaller把py文件转成exe文件

pyinstaller main.py

这样main.py就转成main.exe了

 【python综合运用】制作数学小练习(一)

 

相关文章:

  • 2021-12-04
  • 2021-04-10
  • 2021-10-30
  • 2021-10-14
  • 2021-09-19
猜你喜欢
  • 2021-05-30
  • 2021-11-26
  • 2021-11-04
  • 2021-07-21
  • 2021-06-17
  • 2022-12-23
相关资源
相似解决方案