brucep123 发表于 2017-8-7 15:23:57

你好 关于easygui有个问题请问如何实现?

import easygui as e
temp=int(input())
while 1:
        e.buttonbox(choices=(range(temp))
假设 temp为9 会有9个button
如果之后选择了一个 比如button3 怎样实现在下一次循环时把这个button3去掉,
只有button1-2,button4-9这样子?

ba21 发表于 2017-8-8 00:20:00

参考

import easygui as e
temp=int(input())
s=''
bt = list(range(temp))
while 1:
    if s != '':
      bt.remove(s)
      s = ''
    else:
      try:
            s=e.buttonbox(choices=bt)
      except IndexError:
            break

brucep123 发表于 2017-8-8 15:57:36

ba21 发表于 2017-8-8 00:20
参考

谢谢解答 这个方案我本来有想到 但以为choices必须赋值元祖 就没有使用列表尝试 想当然没有进行实践 哎 不管怎样感谢
页: [1]
查看完整版本: 你好 关于easygui有个问题请问如何实现?