|
发表于 2023-11-26 15:42:31
|
显示全部楼层
from tkinter import *
import random
tkscore = random.randint(0, 9)
r2 = input('0, 1 输入什么:')
try:
r2 = input('0, 1 输入什么:')
except ValueError as e:
print(e.reason)
except TypeError as e:
print(e.reason)
r3 = input('0, 2 输入什么:')
try:
r3 = input('0, 2 输入什么:')
except ValueError as e:
print(e.reason)
except TypeError as e:
print(e.reason)
r4 = input('1, 0 输入什么:')
try:
r4 = input('1, 0 输入什么:')
except ValueError as e:
print(e.reason)
except TypeError as e:
print(e.reason)
r6 = input('1, 2 输入什么:')
try:
r6 = input('1, 2 输入什么:')
except ValueError as e:
print(e.reason)
except TypeError as e:
print(e.reason)
r7 = input('2, 0 输入什么:')
try:
r7 = input('2, 0 输入什么:')
except ValueError as e:
print(e.reason)
except TypeError as e:
print(e.reason)
r8 = input('2, 1 输入什么:')
try:
r8 = input('2, 1 输入什么:')
except ValueError as e:
print(e.reason)
except TypeError as e:
print(e.reason)
root = Tk()
button_1 = Button(text=tkscore, bd='yellow').grid(row=0, culunm=0)
button_2 = Button(text=r2, bg='yellow').grid(row=0, culunm=1)
button_3 = Button(text=r3, bg='yellow').grid(row=0, culunm=2)
button_4 = Button(text=r4, bg='yellow').grid(row=1, culunm=0)
button_5 = Button(text=tkscore, bg='yellow').grid(row=1, culunm=1)
button_6 = Button(text=r6, bg='yellow').grid(row=1, culunm=2)
button_7 = Button(text=r7, bg='yellow').grid(row=2, culunm=0)
button_8 = Button(text=r8, bg='yellow').grid(row=2, culunm=1)
button_9 = Button(text=tkscore, bd='yellow').grid(row=2, culunm=2)
if r2 = r3 = r4 = r6 = r7 = r8:
print('no no')
if r2 != r3 != r4 != r6 != r7 != r8:
print('yes~ yes~')
mainloop() |
|