热乎乎的积分器做好了!才34行代码,别忘了保存再运行!
完整代码:
from tkinter.messagebox import*
from tkinter.simpledialog import*
from tkinter import*
window = Tk()
window.title('计分器')
a = '0'
b = '0'
c = '0'
d = '0'
frame = Frame(window)
frame.pack()
game = 1
while game <= 35:
game = game + 1
a_score1 = askinteger(title = '给A加分:', prompt = '给A加分:')
b_score1 = askinteger(title = '给B加分:', prompt = '给B加分:')
c_score1 = askinteger(title = '给C加分:', prompt = '给C加分:')
d_score1 = askinteger(title = '给D加分:', prompt = '给D加分:')
an = 'a方'
bn = 'b方'
cn = 'c方'
dn = 'd方'
#p = '局的分数'
a = a + a_score
b = b + b_score
c = c + c_score
d = d + d_score
showinfo(an,a_score1)
showinfo(bn,b_score1)
showinfo(cn,c_score1)
showinfo(dn,d_score1)
if game > 35:
showwarning('Error!','局数不能超过35!')