1 Star 0 Fork 46

雷莫/qytang_Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
2016.1.9.随机数产生器 716 Bytes
一键复制 编辑 原始数据 按行查看 历史
import random
import time
from tkinter import *
class randomIntShow(Frame):
def __init__(self, msecs = 1000):
Frame.__init__(self)
self.msecs = msecs
self.pack()
labelfont = ('times', 100, 'bold')
self.colors = ['black', 'orange']
self.i = 0
ii = random.randint(1,5)
lab = Label(self, text = ii)
lab.config(font = labelfont, width = 2)
lab.pack()
self.ii = ii
self.lab = lab
self.repeater()
def repeater(self):
self.bell()
self.ii = random.randint(1,5)
self.i = self.i+1
n = self.i%2
self.lab.config(fg = self.colors[n], text = self.ii)
self.after(self.msecs, self.repeater)
if __name__ == '__main__':
randomIntShow(msecs = 1000).mainloop()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/cc8601/qytang_Python.git
git@gitee.com:cc8601/qytang_Python.git
cc8601
qytang_Python
qytang_Python
master

搜索帮助