|
|
发表于 2017-12-23 16:49:10
|
显示全部楼层
再好好理下思路,跟着语法来。代码不可能按着你的想法来
- import random
- from tkinter import *
- import sys
- root = Tk()
- studentsname = "李敏 李德涵 王嘉佳 郭润旭 秦懿格 秦子淏 马瑞涵 殷悦 厉承峻 王喜悦 丁明轩 刘亚欣 徐嘉澜 聂平 张浩哲 孔德润 毕艺 王玲瑜 秦梓程 曹彦昊 冯思瑜 李奕璇 张信杰 李双龙 田莎莎 栾杰 郑广浩 董记锐 张钰宸 郑一搏 李宜芹 张博洋 朱姝颖 何静 安修杭 徐梓豪 刘硕6.6 黄亚鹏 刘云丹 刘子慧 王栋 袁铭阳 文昊敬".split()
- def exit1():
- sys.exit(0)
-
- def xrange():
- num = random.randint(0,len(studentsname)-1)
- name = studentsname[num]
- x = str("请" + str(num + 1) + "号同学"+ name + "回答问题")
- lblString.set(x)
- lblString = StringVar()
- theLabel = Label(root,textvariable=lblString)
- theLabel.pack()
- Button1 = Button(root,text="好",command=exit1)
- Button1.pack()
- Button2 = Button(root,text="继续",command=xrange)
- Button2.pack()
- mainloop()
复制代码 |
|