师傅你而 发表于 2018-8-14 12:11:20

利用python实现数字组合

from tkinter import *  
root = Tk()
  
root.title("数字组合工具")
  
Label(root,text="数字1").grid(row=0,column=0)
  
Label(root,text="数字2").grid(row=1,column=0)
  
e1 = Entry(root)
  
e2 = Entry(root)
  
e1.grid(row=0,column=1,padx=5,pady=5)
  
e2.grid(row=1,column=1,padx=5,pady=5)
  
def account():
  
    num1 = str(e1.get())
  
    num2 = str(e2.get())
  
    print("两次输入数字的组合即将开始")
  
    list1 = [(x,y) for x in num1 for y in num2 ]
  
    num3 = []
  
    for list2 in list1:
  
      print(''.join())
  
      num3.append(''.join())
  
    print("组合完成,共有" + str(len(num3)) + "对组合!")
  
Button(root,text="进行组合",width=10,command=account).grid(row=3,column=0,sticky=W,padx=10,pady=5)
  
Button(root,text="退出",width=10,command=root.quit).grid(row=3,column=1,sticky=E,padx=10,pady=5)
  
root.geometry("300x100+200+20")
  
mainloop()
页: [1]
查看完整版本: 利用python实现数字组合