zwy12138 发表于 2015-11-14 21:25:03

点名器

a=['xxx','xxx','xxx']#..............
from random import randint
from easygui import*
    #--------------------
def com(b,a1):
    w1=[]
    while 1:
      if b=='1' or b=='2' or b=='0':
            se=randint(1,43)
            if a1=='1':
                if (len(w1)==43 and b=='1'):
                  msgbox('循环了一遍了!',title='点名器',ok_button='继续')
                  break
                if (len(w1)==21 and b=='2') or (len(w1)==22 and b=='0'):
                  msgbox('循环了一遍了!',title='点名器',ok_button='继续')
                  break
                if se in w1:
                  continue
                w1.append(se)
            if b=='1' and se%2==1:
                continue
            if b=='0' and se%2==0:
                continue
            if boolbox('No: %d : %s' % (se,a),title='点名器',choices=('退出','继续')):
                break


    #----------------------------
msgbox('',image='./文件/Greeting.gif',ok_button='准备点名')
while 1:
    b=str(indexbox('选择模式:',title='点名器',choices=('单班','双班','全班')))
    a1=str(boolbox('选择功能:',title='点名器',choices=('不重复','可以重复')))
    com(b,a1)
    if boolbox('退出吗?',title='点名器',choices=('确认退出','再次点名')):
      msgbox('',image='./文件/GoodBye.gif')
      break

波叔 发表于 2015-11-15 12:29:20

谢谢分享。受教了。。

喝汽水的狸猫 发表于 2015-11-15 21:01:39

挺不错的{:7_113:}

康小泡 发表于 2015-11-15 22:31:18

{:9_241:}能把点名的过程用图展示出来就好了

song8356000 发表于 2015-11-16 10:18:05

不错,写的不错,来看看
页: [1]
查看完整版本: 点名器