直接上代码了:
import random
import tkinter as tk
class App:
def __init__(self, root):
root.title("seven")
frame = tk.Frame(root)
frame.pack(padx=90,pady=10)
self.true_say = tk.Button(frame, text="真心话", fg="blue", command=self.true_say)
self.true_say.pack(side=tk.LEFT)
self.mao = tk.Button(frame, text="大冒险", fg="blue", command=self.mao)
self.mao.pack(side=tk.LEFT)
def true_say(self):
print("真心话!")
trues = ["到现在为止有几个男/女朋友?","目前为止有没有异性对你表过白?","在场是否有喜欢的异性?"]
label = tk.Label(root, text=trues[random.randint(0,2)], wraplength=500,bg="yellow", compound="left")
label.pack()
def mao(self):
print("大冒险!")
mao = ["给你最近联系(电话)过的一位异性打电话说想TA,并让TA说出“我也想你”","真情对你右手边的异性表白","和对面的人交换手机号"]
label = tk.Label(root, text=mao[random.randint(0,2)], wraplength=500,bg="yellow", compound="left")
label.pack()
root = tk.Tk()
app = App(root)
root.mainloop()