python的showinfo_使用“messagebox.showinfo“在PyCharm

我试着用messagebox.showinfo当我的柜台到达4时显示信息。在import tkinter

from tkinter import *

global cptBalle

global cptPrise

cptBalle = 0

cptPrise = 0

cptRetrait = 0

cptManche = 1

ptsVisiteur = 0

ptsReceveur = 0

coupSurVisiteur = 0

coupSurReceveur = 0

erreurVisiteur = 0

erreurReceveur = 0

equipeAuBaton = "visiteur"

def balle():

global cptBalle

global cptPrise

cptBalle += 1

if cptBalle == 4:

messagebox.showinfo(title="Balle", message="Testtest")

cptBalle = 0

cptPrise = 0

def prise():

pass

def fausse_balle():

pass

def retrait():

pass

def balle_passee():

pass

def mauvais_lancer():

pass

def sacrifice():

pass

def simple():

pass

def double():

pass

def triple():

pass

def circuit():

pass

def atteint():

pass

def erreur():

pass

def creer_bouton():

btnBalle = Button(app, text="Balle", command=balle)

btnBalle.grid(row=1, column=0)

btnPrise = Button(app, text="Prise", command=prise)

btnPrise.grid(row=2, column=0)

btnFausse_balle = Button(app, text="Fausse balle", command=fausse_balle)

btnFausse_balle.grid(row=3, column=0)

btnRetrait = Button(app, text="Retrait", command=retrait)

btnRetrait.grid(row=4, column=0)

btnBalle_passee = Button(app, text="Balle passee", command=balle_passee)

btnBalle_passee.grid(row=5, column=0)

btnMauvais_lancer = Button(app, text="Mauvais lancer", command=mauvais_lancer)

btnMauvais_lancer.grid(row=6, column=0)

btnSacrifice = Button(app, text="Sacrifice", command=sacrifice)

btnSacrifice.grid(row=7, column=0)

btnSimple = Button(app, text="Simple", command=simple)

btnSimple.grid(row=8, column=0)

btnDouble = Button(app, text="Double", command=double)

btnDouble.grid(row=9, column=0)

btnTriple = Button(app, text="Triple", command=triple)

btnTriple.grid(row=10, column=0)

btnCircuit = Button(app, text="Circuit", command=circuit)

btnCircuit.grid(row=11, column=0)

btnAtteint = Button(app, text="Atteint", command=atteint)

btnAtteint.grid(row=12, column=0)

btnErreur = Button(app, text="Erreur", command=erreur)

btnErreur.grid(row=13, column=0)

root = tkinter.Tk()

root.title("Baseball!")

root.geometry("750x350")

app = Frame(root)

app.grid()

creer_bouton()

root.mainloop()

第一个按钮“btnBalle”调用函数“Balle()”。在

当我在pythonidle中运行它时,它可以工作,但当我使用PyCharm时,它就不起作用了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值